I have a small swf test to test the call to an ActionScript (3.0) function from JavaScript. I use the Flash documentation as a link: ( http://www.adobe.ca/livedocs/flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00000340.html ) When the page loads I get Flash Player error:
SecurityError: Error
at flash.external::ExternalInterface$/_initJS()
at flash.external::ExternalInterface$/addCallback()
at externalinterface_fla::MainTimeline/frame1()
This is ActionScript:
import flash.external.ExternalInterface
function callMe(name:String):String{
return "busy signal";
}
ExternalInterface.addCallback("myFunction",callMe);
And JS:
<script type="text/javascript" language="javascript">
function callSwf() {
var callResult = flashObject.myFunction("Nick");
alert(callResult);
}
</script>
Finally, the HTML object:
<object width="550" height="400">
<param name="movie" value="externalinterface.swf">
<embed src="externalinterface.swf" width="550" height="400">
</embed>
</object>
How do we get around this?
source
share