使用AS3多个SWF通信

编程入门 行业动态 更新时间:2024-10-20 08:23:53
本文介绍了使用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通信

本文发布于:2023-11-23 16:00:06,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1622046.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:多个   通信   SWF

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!