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/pla开发者_运维知识库yer-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.
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.
精彩评论