multiple swf communication using as3

╄→гoц情女王★ 提交于 2019-12-13 06:23:53

问题


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('http://webserver/aruldass/versemusic/modules/mod_playerjr/player-songs.swf', 'jwplayer1', '280', '230', '9', false, flashvars, params, attributes); 

swfobject.embedSWF('http://webserver/aruldass/versemusic/modules/mod_playerjr/player-songs.swf', 'jwplayer2', '280', '230', '9', false, flashvars, params, attributes); 

swfobject.embedSWF('http://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.


回答1:


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.


来源:https://stackoverflow.com/questions/6994466/multiple-swf-communication-using-as3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!