开发者

Would this call for Javascript in AS3 work?

stop();

import flash.external.ExternalInt开发者_如何学Pythonerface;

ExternalInterface.addCallback("quarter1call", quarter1call);
function quarter1call():void
{
    gotoAndPlay(2);
}

Would the above script work when attached to a javascript that calls for the 'quarter1call()' function? I am not sure how to code the javascript side of this relationship and I am thus unable to test it, if you could provide any help with that side or just explain if this would work it would be much appreciated.


Yep, this would work fine. The addCallback function exposes your quarter1call() function to the Javascript side of things under the highly unlikely name "quarter1call" ;-)

Depending on how your SWF is embedded in the HTML page, you can call the function using something like this (make sure the HTML element is loaded first):

document.getElementById('idOfSwfElement').quarter1call();

where the HTML resembles:

<embed src="foo.swf" id="idOfSwfElement" />
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜