开发者

call a javascript from a flash? [duplicate]

This question already has answers here: Closed 13 years ago.

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?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜