开发者

ActionScript 3 SharedObjects don't persist across different swfs?

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?

Thank开发者_JAVA百科s


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


SharedObjects are filename-specific and location-specific the root path is:

C:\Users\username\AppData\Roaming\Macromedia\Flash Player\#SharedObjects\436UUXWX\

but for www.example.com/res/flash/file1.swf and www.example.com/res/flash/file2.swf it will be:

C:\Users\username\AppData\Roaming\Macromedia\Flash Player\#SharedObjects\436UUXWX\www.example.com\res\flash\file1.swf\

and:

C:\Users\username\AppData\Roaming\Macromedia\Flash Player\#SharedObjects\436UUXWX\www.example.com\res\flash\file2.swf\
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜