PDA

View Full Version : external interface and swfobject


fatfrank
06-22-2011, 10:38 PM
Hi
I'm having some trouble with external interface and swfobject. Just can't seem to get external interface to communicate with my swf. Incidently it works when I publish it the traditional way, just not when I'm using swfobject! Any help would be appreciated!

JS:
<script type="text/javascript" src="js/swfobject.js"></script>

<script type="text/javascript">
var flashvars = {};
var params = {wmode:"opaque", allowscriptaccess:"always" };
var attributes = {id:"movie2", name:"movie2"};
//
swfobject.embedSWF("images/movie2.swf", "movie2", "550", "400", "9.0.0", false, flashvars, params, attributes);
//
function getFlashMovie(id) {
return document.getElementById(id);
}
function stopFlash(){
getFlashMovie("movie2").commandFlash();
}
</script>

HTML:
<a href="#" name="stop" onClick="stopFlash()"><div id="next"></div></a>


AS3:
ExternalInterface.addCallback("commandFlash", stopPlaying);

fatfrank
06-22-2011, 10:48 PM
OK - sorted it....

function stopFlash(){
document.getElementById('movie2').commandFlash();
return true;
}

instead of:

function getFlashMovie(id) {
return document.getElementById(id);
}
function stopFlash(){
getFlashMovie("movie2").commandFlash();
}

janita123
07-04-2011, 09:40 AM
I also do have the same problem. Please reply as soon as possible. Thanks in advance.