Flash AS3: Call javascript function

I am trying to execute external javascript function from the swf using AS3.

In first keyframe in main Scene i put this code:

import flash.external.ExternalInterface;
import flash.net.URLRequest;

flash.net.navigateToURL(new URLRequest("javascript:myfunction()"));
ExternalInterface.call("alert", "123");

This is all variants I know to execute javascript function.

In the HTML I have following statement in tag:

<param name="allowScriptAccess" value="always" />

And my function is:

<script type="text/javascript">
function myfunction() {
    alert("This function was successfully triggered via the flash movie.");

Whole solution does not work. Has anyone idea what this issue occurs?

Source: javascript

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.