-
flash, javascript and IE
hi - i have javascript talking with Flash. Works great in Firefox (as is always the case), but IE (all versions) has issues. Essentially i get a warning at the line of code that innerHTML starts (after the appendChild)- i had read i needed to append the child before writring innerHTML , but that still is not the trick.
Can you take a look, and tell me what i need to tell IE? I am thinking it has to do with ActiveXObject???
Code:
function playVid(src){
var pb=document.getElementById("player");
var pl=document.getElementById("FLVPlayer");
if(pl){
pb.removeChild(pl);
}
var src=src;
var em=document.createElement("object");
em.classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000";
em.setAttribute("codebase","http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0");
em.setAttribute("width","640");
em.setAttribute("height","490");
em.id="FLVPlayer"
pb.appendChild(em);
em.innerHTML="<param value=\"myPlayer.swf?contnt="+src+"\" name=\"movie\" /><param value=\"sameDomain\" name=\"allowScriptAccess\"/>";
em.innerHTML+= "<param value=\"high\" name=\"quality\" /><param value=\"noscale\" name=\"scale\"/>";
em.innerHTML+="<embed src=\"myPlayer.swf?contnt="+src+"\" quality=\"high\" width=\"640\" height=\"490\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />";
}
-
Senior Member
have a look at SWFObject. It does what you want to do, and a lot more.
-
yes that is interesting. i am choosing to go my own direction on this...no prewritten scripts. So far i am learning that the big hang up was the innerHTML call. So i have rewrtitten to the below. Now, i have no warnings in IE, but instead, after i click, IEseems to perform the javascript fine, but then will not play the flash movie....any more thoughts. i am sure this is an activeX issue
Code:
function playVid(src){
var pb=document.getElementById("player");
var pl=document.getElementById("FLVPlayer");
if(pl){
pb.removeChild(pl);
}
var src=src;
var em=document.createElement("object");
em.setAttribute("classid","clsid:D27CDB6E-AE6D-11cf-96B8-444553540000");
em.setAttribute("codebase","http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0");
em.setAttribute("width","640");
em.setAttribute("height","490");
em.id="FLVPlayer"
var pr=document.createElement("param");
pr.setAttribute("name","movie");
pr.setAttribute("value","myPlayer.swf?contnt="+src);
em.appendChild(pr);
var pr2=document.createElement("param");
pr2.setAttribute("name","quality");
pr2.setAttribute("value","high");
em.appendChild(pr2);
var pr3=document.createElement("param");
pr3.setAttribute("name","allowScriptAccess");
pr3.setAttribute("value","sameDomain");
em.appendChild(pr3);
if(!window.ActiveXObject){
var embed=document.createElement("embed");
embed.setAttribute("src","myPlayer.swf?contnt="+src);
embed.setAttribute("qality","high");
embed.setAttribute("width","640");
embed.setAttribute("height","490");
embed.setAttribute("type","application/x-shockwave-flash");
em.appendChild(embed);
}
pb.appendChild(em);
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|