Created
October 5, 2012 13:25
-
-
Save kontur/3839798 to your computer and use it in GitHub Desktop.
javascript getter for a flash object on page, for calls to external interface
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getFlashMovie(movieName) { | |
var isIE = navigator.appName.indexOf('Microsoft') !== -1; | |
return (isIE) ? window[movieName] : document[movieName]; | |
} | |
// with a swfobject embedding like: | |
var flashvars = {}; | |
var params = {}; | |
var attributes = {}; | |
attributes.id = "myFlash"; // required for flash to javascript communication | |
swfobject.embedSWF("path/to/flash.swf", "flashWrapper", "550", "400", | |
"10.0.0", false, flashvars, params, attributes); | |
// use like: | |
getFlashMovie('myFlash').someFunctionAddedInFlash(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment