jlizarraga
05-13-2008, 10:50 PM
I am using the External API in the most basic way possible: to play a movie when the page is finished loading.
Everything works just fine, but for some strange and mysterious reason, I can't change the filename of the swf I'm using.
Here is the simple js code:
// Flash External API Functions
function callExternalInterface() {
getMovieName("myMovie").callPlayBall();
}
function getMovieName(movieName) {
if (navigator.appName.indexOf("Microsoft") != -1) {
return window[movieName]
}
else {
return document[movieName]
}
}
And here's the html:
<script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','980','height','385','src','images/homepage_loader','quality','high','wmode','opaque','allowScriptAccess','always','id','myMovie','name','myMovie','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','images/homepage_loader' ); //end AC code
</script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="980" height="385" id="myMovie" align="middle">
<param name="allowScriptAccess" value="always" />
<param name="movie" value="images/homepage_loader.swf" />
<param name="quality" value="high" />
<param name="wmode" value="opaque" />
<embed src="images/homepage_loader.swf" quality="high" wmode="opaque" name="myMovie" align="middle" allowScriptAccess="always" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="980" height="385"></embed>
</object></noscript>
And then there is the body onLoad calling the callExternalInterface function. This works great. But if I export the homepage_loader.fla as homepage_loader2.swf (and change all four references in the above code to match), I am greeted with a "callPlayBall is not a function" error.
The javascript is using the id/name of the swf to manipulate it, not the filename. Why would simply changing the filename of the swf cause my External API function to break? :confused:
In case it helps, I'm using CS3 with AS2.0.
Everything works just fine, but for some strange and mysterious reason, I can't change the filename of the swf I'm using.
Here is the simple js code:
// Flash External API Functions
function callExternalInterface() {
getMovieName("myMovie").callPlayBall();
}
function getMovieName(movieName) {
if (navigator.appName.indexOf("Microsoft") != -1) {
return window[movieName]
}
else {
return document[movieName]
}
}
And here's the html:
<script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','980','height','385','src','images/homepage_loader','quality','high','wmode','opaque','allowScriptAccess','always','id','myMovie','name','myMovie','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','images/homepage_loader' ); //end AC code
</script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="980" height="385" id="myMovie" align="middle">
<param name="allowScriptAccess" value="always" />
<param name="movie" value="images/homepage_loader.swf" />
<param name="quality" value="high" />
<param name="wmode" value="opaque" />
<embed src="images/homepage_loader.swf" quality="high" wmode="opaque" name="myMovie" align="middle" allowScriptAccess="always" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="980" height="385"></embed>
</object></noscript>
And then there is the body onLoad calling the callExternalInterface function. This works great. But if I export the homepage_loader.fla as homepage_loader2.swf (and change all four references in the above code to match), I am greeted with a "callPlayBall is not a function" error.
The javascript is using the id/name of the swf to manipulate it, not the filename. Why would simply changing the filename of the swf cause my External API function to break? :confused:
In case it helps, I'm using CS3 with AS2.0.