Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Mar 2005
    Posts
    111
    Thanks
    0
    Thanked 0 Times in 0 Posts

    using javascript to embed flash doesnt work in IE

    this code works fine in FF but not IE, anyone know why?

    Code:
    <script type="text/javascript" src="flashobject.js"></script>
    <script type="text/javascript">
    function get_random() {
        var ranNum= Math.floor(Math.random()*4);
        return ranNum;
    }
    function getRandomFile() {
    	var source = new Array("images/1.gif", "images/2.swf", "images/3.jpg", "images/4.png");
    	var which = get_random();
    	var filename = source[which];
    	var dot = source[which].lastIndexOf(".");
    	if(dot == -1) return "";
    	
    	var extension = filename.substr(dot,filename.length);
    	if(extension == ".gif") {
    		document.write("<img src="+source[which]+" alt="+source[which]+" />");
    	} else if(extension == ".jpg") {
    		document.write("<img src="+source[which]+" alt="+source[which]+" />");
    	} else if(extension == ".png") {
    		document.write("<img src="+source[which]+" alt="+source[which]+" />");
    	} else if(extension == ".swf") {
    		var fo = new FlashObject(""+source[which]+"", "animationName", "", "", "8", "#FFFFFF");
    		fo.addParam("allowScriptAccess", "sameDomain");
    		fo.addParam("quality", "high");
    		fo.addParam("scale", "scale");
    		fo.addParam("loop", "false");
    		fo.write("place");
    	} else {
    		return false;
    	}
    }

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    FL, USA
    Posts
    734
    Thanks
    0
    Thanked 0 Times in 0 Posts
    can you post the code it creates?
    CYWebmaster.com - See why we dot com!!
    ACJavascripts.com - Cut & Paste Javascripts!
    SimplyProgram.com - Personal Blog

  • #3
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Hmm you are actually missing two parameters in your FlashObject function. The width and height. Without those its not going to render. It also looks like you have an outdated version of flashobject because now its called swf object.

    http://blog.deconcept.com/swfobject/
    ||||If you are getting paid to do a job, don't ask for help on it!||||


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •