Local Shared Objects…not so Shared. Cross Domain Projector Issues. September 12, 2007
We have a a few Desktop Flash applications: One is a main application, the other an update utility for the main app. They use a Flash Cookie to find each other, as the main app could be installed anywhere (USB, C), so it writes to the cookie where it's installed at. The apps are based in Director using the Flash Xtra.
Say we start with a completely empty SharedObjects folder
Running the main app sets a cookie into a folder like
....Flash Player\#SharedObjects\BFYLPV7P\localhost\02000.sol
via a call like
var so : SharedObject = SharedObject.getLocal ("02000", "/");
where "/" should see the root of the Flash Cookies.
then say Pandora (or any other flash based website using cookies) runs it generates a new sandbox
....Flash Player\#SharedObjects\2S7GJDMQ\pandora.com
and then all future read requests are against that new '2S7GJDMQ' folder instead of the "BFYLPV7P" folder, and then neither the app or the updater, can see the old shared local object folder anymore. Which in the case of it containing lots of persistent configuration data, is the equivalent of clearing the Browser cache and forgetting everything.
Trying to understand how it's created, I can delete the contents of the shared Objects folder and then republish in the Flash IDE and get a new hash for the folder every time so it seems to be either random or time based. It's not as far as I can tell the behaviour documented, it's certainly not behaving as I would expect.
As mentioned here. It used to be that one could work around this via:
SharedObject.getRemote("my_so", "rtmp:/./..", "/");
sadly it no longer works in Flash 8, or 9.
I got this reply on the FlashCoders list:
>Movies running in different sandboxes cannot access shared objects of
>each other.
Yes, that makes sense, except for 2 things:
1) As far as I can tell, they should NOT be in separate sandboxes, they
use the exact same code, and are installed in next to the same folder. As far
as I can tell there is no way to specify the domain for a projector to get the
desired behavior.
2) It's also inconsistent. First run it WILL use the same sandbox as the Flash IDE/etc, then later something will trigger the generation of a new sandbox (install a second version of the app, or view pandora) then all further requests go against the new sandbox instead of the original. Meaning the Flash Player changes it's mind about which domain it thinks it belong to!
My best guess, likely due to it running in a projector without access to URL information, it's making stuff up.
Our first attempt at solving, required upgrading the Flash Xtra in both projectors to Flash8, apparently having one at Flash7 and the other Flash8 is enough to trigger the domain.
Also interesting is the Flash IDE never really seems to have this problem, presumably because it is using the Flash Player EXE as the handler for all swfs via the registry. So one potential workaround was firing a Flash Projector with the sole point in life to read/write the local Shared Object, with local connection object to read how flash sees it and then shut down.

Add a Comment: