ActionScript 3 SharedObjects 不能在不同的 swf 之间持久存在?
我正在提供两个不同的 swf,它们读取和写入同一个 SharedObject 变量。 SharedObject 变量是一个数字,每个 swf 都会检查该数字以确保它不会两次使用相同的数字。然后它会存储它选择的最后一个数字。这样,无论加载顺序如何,两个 swf 都不应两次使用相同的数字。
如果我重复加载其中一个 swf,则不会两次旋转。但是,在swf之间来回切换时,有时会出现数字重复的情况。 SharedObjects 对于 Flash Player 来说应该是全局的,那么为什么会发生这种情况呢?
谢谢
I am serving two different swfs that read and write to the same SharedObject variable. The SharedObject variable is a number, and each swf checks that number to make sure it isn't using the same number twice. It then stores the last number it selects. In this way both swfs should never use the same number twice, no matter which order they're loaded.
If I repeatedly load one of the swfs, the never-twice rotation works. However, when switching back and forth between swfs, sometimes the number is repeated. SharedObjects are supposed to be global to the Flash Player, so why would this happen?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
共享对象实际上有自己的文件夹,这样它们就不会与另一个同名的 SO 发生冲突。如果您想让多个 SWF 访问单个 SO,那么您需要为该 SO 指定一个实际路径,而不是让 Flash 为您创建一个路径。这会强制 SWF 读/写相同的 SO。
以下文章包含更深入的解释和一些不同的解决方案:
http: //help.adobe.com/en_US/as3/dev/WS5b3ccc516d4fbf351e63e3d118a9b90204-7d80.html
Shared Objects are actually given their own folder so that they do not potentially collide with another SO of the same name. If you want to have multiple SWF's access a single SO, then you need to specify an actual path for the SO instead of allowing Flash to create one for you. This forces the SWF to read/write the same SO.
Here is the article that contains a deeper explanation and a few different solutions:
http://help.adobe.com/en_US/as3/dev/WS5b3ccc516d4fbf351e63e3d118a9b90204-7d80.html
共享对象是特定于文件名和特定于位置的
根路径是:
但对于 www.example.com/res/flash/file1.swf 和 www.example.com/res/flash/file2.swf 它将是:
和:
SharedObjects are filename-specific and location-specific
the root path is:
but for www.example.com/res/flash/file1.swf and www.example.com/res/flash/file2.swf it will be:
and: