...

View Full Version : using javascript to embed flash doesnt work in IE



mhunt
02-16-2007, 06:23 PM
this code works fine in FF but not IE, anyone know why?



<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;
}
}

ACJavascript
02-17-2007, 04:53 PM
can you post the code it creates?

_Aerospace_Eng_
02-17-2007, 05:52 PM
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/



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum