views:

106

answers:

3

Possible Duplicate:
How do you trigger javascript functions from flash?

Possible Duplicate: How do you trigger javascript functions from flash?

Can flash call a javascript?

For example a Button in a flash will call a function ($("div.boxclose").addClass("boxopen").show("slow");) from jQuery library.

Is that possible?

Thanks!

A: 

Please take a look at this SO question: How do you trigger javascript functions from flash?

Jochen Hilgers
+2  A: 

If you are using AS3, ExternalInterface.call is what you want.

In the script tag in the html page:

function theJSMethod()
{
    $("div.boxclose").addClass("boxopen").show("slow");
}

In flash:

ExternalInterface.call("theJSMethod");

If you are using AS2, you can use fscommand to achieve this.

Make sure allowScriptDomain in the embedding html code is set appropriately.

Amarghosh