Skip to content

Instantly share code, notes, and snippets.

@kontur
Created October 5, 2012 13:25
Show Gist options
  • Save kontur/3839798 to your computer and use it in GitHub Desktop.
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
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