Reputation: 31
Suppose the swf file is embeded into the page with the following code:
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" id="myFlash" width="600" height="500">
<param name="movie" value="myMovie.swf">
<embed type="application/x-shockwave-flash" src="myMovie.swf" name="myFlash" width="600" height="500" >
</embed>
</object>
What are the ways to get a reference to the movie with the help of JavaScript?
Upvotes: 0
Views: 4460
Reputation: 17756
This is the shortest answer I can write:
var swf = this["mySWF"];
Upvotes: 0
Reputation: 2888
It's easy, but you need to be weary of Internet Explorer
var myFlash = $.browser.msie ? window[ 'myFlash' ] : document[ 'myFlash' ];
Upvotes: -1
Reputation: 29303
function getMovie(movieName) {
if (navigator.appName.indexOf("Microsoft") != -1) {
return window[movieName];
} else {
return document[movieName];
}
}
var flash = getMovie('myFlash')
Upvotes: 2
Reputation: 28753
Does...
var myReference = document.getElementById("myFlash");
... suit your needs? What do you aim to do with this reference once you are done?
Upvotes: 0