无需重新打开即可获取更新的共享对象数据

发布于 2025-01-03 07:26:26 字数 368 浏览 7 评论 0原文

我有 2 个 swf 文件将被加载到网站上。假设生成一个字节数组并传递给另一个 swf。

问题是,当我将 bytearray 保存到用户本地文件中的 SharedObject 时,第二个 swf 无法从第一个 swf 获取更新的变量值。

我已将第二个 swf 设置为每秒检索一次值,并且在重新加载页面之前它不会更新。

我刷新并关闭连接以确保数据保存在本地路径上,但这也没有帮助。

我也考虑过使用 LocalConnection,但是 mac 版 flash 播放器中存在一个错误,导致它无法在 mac 上的 swf 之间工作。让我别无选择,只能在我的项目中使用 SharedObject。

你们有什么解决办法吗?

非常感谢..

I have 2 swf that will be loaded on a website. One suppose to generate a bytearray and being passed over to another swf.

The problem is that when I save the bytearray to a SharedObject in user's local file, the second swf doesn't get the updated variable value from the first swf.

I've set the second swf to retrieve the value every one second and it don't get updated until I reload the page.

I flushed and close the connection to make sure the data is saved on the local path and that is not helping as well.

I also considered using LocalConnection as well but there is a bug in flash player for mac that stopping it to work between swfs on mac. Left me no choice but to use SharedObject for my project.

Do you guys have any solution for this?

Many thanks..

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

吃素的狼 2025-01-10 07:26:26

我认为这种方法行不通(本地 SharedObject 的设计可能没有考虑到这一点,并且浏览器和 Flash 播放器版本之间的确切行为可能有所不同)。

我会尝试使用 LocalConnection 代替。
http://help.adobe.com/en_US /FlashPlatform/reference/actionscript/3/flash/net/LocalConnection.html

编辑:抱歉,我错过了:
“我也考虑过使用 LocalConnection,但 mac 版 flash 播放器中存在一个错误,导致它无法在 mac 上的 swf 之间工作。让我别无选择,只能在我的项目中使用 SharedObject。”

我一直在mac上使用本地连接,所以我不确定你指的是什么。我强烈建议使用每个页面视图生成一次的随机数并将其发送到闪存(用作连接名称的一部分),以确保您不会打开多个具有相同名称的连接(如果例如,用户在不同的选项卡中多次打开您的网站)。

I don't think this approach will work (the local SharedObject probably isn't designed with this in mind, and the exact behavior might differ between browsers and flash player versions).

I would try using LocalConnection instead.
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/LocalConnection.html

EDIT: Sorry, I missed this:
"I also considered using LocalConnection as well but there is a bug in flash player for mac that stopping it to work between swfs on mac. Left me no choice but to use SharedObject for my project."

I use local connection on mac all the time, so I'm not sure what you are referring to. I would strongly recommend using a random number that is generated once per page view and send it to the flash (to use as a part of the connection name), to ensure that you don't open several connections with the same name (if the user opens your site several times in different tabs for example).

我不在是我 2025-01-10 07:26:26

我使用这种沟通方式没有任何问题,而且效果很好。改变值后是否调用flush?

I use this method of communication without problem and it's works fine. Do you call flush after changing the value?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文