本文介绍了使用AS3多个SWF通信的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要: 如果我播放一个SWF,其他主权财富基金应暂停,如果被打。
我能沟通使用JavaScript两个SWF(包括主权财富基金是不同的名称)。但前来多个主权财富基金,我不知道如何区分主权财富基金东阳都是相同的名称。
我已经尝试使用下面的脚本嵌入到我html页面3 SWF文件。
swfobject.embedSWF('webserver/aruldass/versemusic/modules/mod_playerjr/player-songs.swf', jwplayer1','280','230','9',假的,Flash变量,参数,可以属性); swfobject.embedSWF('HTTP://webserver/aruldass/versemusic/modules/mod_playerjr/player-songs.swf','jwplayer2','280','230','9',假的,Flash变量,参数,可以属性) ; swfobject.embedSWF('HTTP://webserver/aruldass/versemusic/modules/mod_playerjr/player-songs.swf','jwplayer3','280','230','9',假的,Flash变量,参数,可以属性) ;
我要相互沟通。
与我们分享您的想法。
解决方案嗯,我想我会解决这个问题的方式如下:
- 修改SWF生成在创建一个随机ID
- 添加有一个id值作为参数,并呼吁所有的SWF中的pre定义函数的JavaScript函数(比方说 processPlayEvent(ID:字符串):无效
- 使用闪光灯 ExternalInterface的来调用该函数传入当前SWF ID作为参数
- 在 processPlayEvent 功能,您检查所提供的ID等于当前的电影之一。如果他们是不平等的,要暂停当前SWF的播放。
My need : If I playing one swf, the other swfs should pause if it was playing.
I can able to communicate two swfs using javascript(both swfs are different name). But come to multiple swfs, I don't know how to differentiate the swfs beacause all are same name.
I have embed 3 swf files in my html page using the following script.
swfobject.embedSWF('webserver/aruldass/versemusic/modules/mod_playerjr/player-songs.swf', 'jwplayer1', '280', '230', '9', false, flashvars, params, attributes); swfobject.embedSWF('webserver/aruldass/versemusic/modules/mod_playerjr/player-songs.swf', 'jwplayer2', '280', '230', '9', false, flashvars, params, attributes); swfobject.embedSWF('webserver/aruldass/versemusic/modules/mod_playerjr/player-songs.swf', 'jwplayer3', '280', '230', '9', false, flashvars, params, attributes);I want to communicate each other.
Share your ideas.
解决方案Well I think I would solve this problem the following way:
- Modify the SWF to generate a random id upon creation.
- Add a JavaScript function that has an id-value as parameter and calls a pre-defined function on ALL the SWF (let's say processPlayEvent(id:String):void
- Use the Flash ExternalInterface to call that function passing the current SWF Id as a parameter
- Inside the processPlayEvent function you check if the provided id equals the one of the current movie. If they are unequal, you halt the playback of the current SWF.
更多推荐
使用AS3多个SWF通信
发布评论