call a javascript from a flash? [duplicate]
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.boxcl开发者_JAVA百科ose").addClass("boxopen").show("slow");) from jQuery library.
Is that possible?
Thanks!
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.
External Interface will help you :)
http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/external/ExternalInterface.html
Please take a look at this SO question: How do you trigger javascript functions from flash?
精彩评论