0

I am trying to call a Jscript function from a flash object. I want the function to be called when the animation ends.

Here is the embed code

<h1 align="center">  
<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
        codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" 
        WIDTH="360" HEIGHT="250" id="Yourfilename" ALIGN="center">
    <PARAM NAME=movie VALUE="newbanner.swf">
    <PARAM NAME=quality VALUE=high/><param name="LOOP" value="false" />
    <param name="allowscriptaccess" value="always" />
    <param name="wmode" value="transparent">
    <param name="bgcolor" value="#FFFFFF">
    <EMBED src="newbanner.swf" quality="high" bgcolor="#FFFFFF" 
           WIDTH="360" HEIGHT="250" loop="false" NAME="newbanner.swf" ALIGN=""
           TYPE="application/x-shockwave-flash" 
           PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">
    </EMBED> 
</OBJECT>
</h1>

here is the jScript function i want to call:

<script language="javascript">
    function mainFunction() {
        var mydiv = document.getElementById('content');
        mydiv.innerHTML = "hello";
    }
</script>

here is the action code I add to the last frame of the flash object

URLLoader("javascript:mainFunction();");

The object loads but the function is not called. I can call the function other ways such as using an "onclick = mainFunction()" event on a button for example. Where am i going wrong?

thanks in advance.

1

1 Answer 1

1

Why don't you use flash.external.ExternalInterface.call ?

Sign up to request clarification or add additional context in comments.

5 Comments

could you give me a quick example of how I would use this please?
I added the following to the last frame of AS: ExternalInterface.call("mainFunction();"); It still isnt working :(
it shouldn't be "mainFunction();" just "mainFunction"
it shouldn't be "mainFunction();" just "mainFunction" -- this worked thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.