(AS3)同步在同一页上3个或更多相同闪光对象之间的数据闪光、对象、更多、数据

2023-09-08 14:44:14 作者:- 滥情少年 R3n,

我也问过类似以前的东西,但从来不去我需要的解决方案。于是我开始一个新的堆栈不是迷惑我的问题,并作出更清晰一点。

I have asked something similar before, but never go to the solution I need. So am starting a new stack to not confuse my issues, and to make a little clearer.

我需要做的

我有一个HTML页面上的多个Flash对象,他们都是相同的,他们都需要与正确的时间同步时间。在当前状态下,每一个查询时间服务器,并获取时间,伟大的工程。但我想实现的是第一个加载是唯一一个同步的与时间服务器,然后将另一闪光物等待它完成,并从一个负载同步时间。

I have multiple flash objects on a html page, they are all identical, and all of them need to be sync'd with the correct time. In its current state, each one queries the timeserver, and gets the time, which works great. BUT what I want to achieve is the first one to load to be the only one that sync's with the time server, and then the other flash objects wait for it to finish, and load the sync time from that one.

问题

共享对象: 在纸面上,这有缝像是一个完美的解决方案,我得到的第一个1载入保存如此timestarted,如果在此之后的任何加载闪存看到这个是这样,等待同步时间,所以被创建,并加载...大!但是,没有...共享对象只出现加载因此在加载闪存,任何改变,或新,使闪光灯加载后是完全陌生的其他任何闪光比创建它的时间! (直到闪光灯重新加载)... DOH

SharedObjects: On paper, this seamed like the perfect solution, I get the 1st one to load to save a SO "timestarted", if any loading flash after that sees this SO, it waits for a "synctime" SO to be created, and load that...great! But no... SharedObjects only appear to load the SO at the time of loading the flash, any changes, or new SO after the flash loads is completely unknown to any other flash than the one that created it! (until the flash is reloaded)...doh

的LocalConnection: 稍微复杂一点,但听起来像一个很好的解决方案,除了只有一个闪光灯可以在任何一个时间的连接打开,GAH!

LocalConnection: A little more complicated, but sounded like a good solution, apart from only one flash can have the connection open at any one time, gah!

我需要什么

在简单来说,我需要一种方法来有一个Flash对象声明自己为sync'er,和别人听好了!东西我以为会是这么简单,而是转向了这么复杂。我需要任何建议,做什么意见。

In simple terms I need a way to have one flash object declare itself as the sync'er, and the others to listen up! Something I thought would be so simple, but turning out to be so complicated. I need any suggestions, advice on what to do.

推荐答案

如果您可以使用JavaScript,你可以用做一点点 ExternalInterface的。有电影召唤出一个小JS脚本,用于跟踪谁正在加载的时间,然后让对方闪烁只登记回调。一旦第一个闪光的时候,召唤出的JS,让该更新其他两个。

If you can use a tiny bit of javascript you can do this using ExternalInterface. Have the movies call out to a small js-script that keeps track of whoever is loading the time, then have the other flashes just register callbacks. Once the first flash has the time, call out to the js and let that update the other two.