我有一个项目,其中我有一个movie.swf (AS2)和一些按钮与js/jQuery的html部分。现在我要用按钮来控制闪光灯。例如,按Button1将执行gotoAndPlay(1)和Button2 gotoAndPlay(150) Button3 gotoAndStop(450)
Flashmovie电影适用于Actionscript 2。
发布于 2010-12-04 11:50:59
你需要看一看ExternalInterface的文档,它在网页中提供了JavaScript和Flash之间的链接。
基本步骤与在Flash中导入库的思路相同:
import flash.external.ExternalInterface;
然后,您可以使用addCallback()
绑定要从Javascript调用的例程
ExternalInterface.addCallback('stopVideo', stopVideo);
function stopVideo() {
...
}
它在网页上的flash对象上提供了一个名为stopVideo()
的函数。
您还可以使用call()
从闪存中调用Javascript函数
ExternalInterface.call('updatePlayerInfo', "STOPPED");
它使用参数'STOPPED'
调用名为updatePlayerInfo()
的Javascript例程。
AS3 documentation for ExternalInterface和AS2很像,我现在好像找不到AS2文档。
发布于 2010-12-04 11:56:00
http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/external/ExternalInterface.html
外部接口将在这方面为您提供帮助。在上面你可以找到adobe参考,下面有很多关于这个主题的问题。这与AS2/AS3相同
Pass a callback in ExternalInterface
jQuery(this) and ExternalInterface
Is there a way to call a Javascript class method from ExternalInterface?
How to expose the JavaScript interface for an embedded Flash object?
发布于 2010-12-06 08:08:44
这可能有助于标准化如何获得对调用回调的运行swf的引用:jQuery SWFObject Plugin
https://stackoverflow.com/questions/4353289
复制