Friday, September 21, 2012

Solved bug with Shared Object in google chrome

 

We have struck on the bug with Shared Objects(SO) in Google chrome(it saves them in his own location),so the game we’ve created wasn’t able to load saves from Shared Object but was able to save them.
The problem was solved after few hours – here is solution if you have struck on the same bug:
- First of all – Google Chrome saves flash cookies in his own folder in program files
- If the path length is too long for Google Chrome it’ll break it on separate parts, and after this we can’t reach desired Shared Object file
Sample path for Shared Object save data:

http://www.somesite.com/manymanymanymanymanymanymanymanymanymanymanymanymany_characters_and_then_
mygame_name.swf

so if you use default Shared Object settings:
var so:SharedObject = SharedObject.getLocal(“My_Savefile”); so.flush();
you’ll receive Google Chrome Shared Object directory path something like this:
#SharedObjects\ %RANDOM_ID%\ www.somesite.com\ manymanymanymanymanymanymanymanymanymanymanymany\ many_characters_and_then_my_game_name\ My_Savefile.sol
Now you can see that Google Chrome broke path for a few parts with “\”,that makes it harder to find desired Shared Object.
Solution for this is simple – Use your own path to Shared Object, and not the default one.
Sample:
var so:SharedObject = SharedObject.getLocal(“MyDirectoryName/My_Savefile”, “/”); so.flush();
In this case, no matter how log is the URL of your game, you will always have this type of path to your Shared Objects:
#SharedObjects\%RANDOM_ID%\www.somesite.com\#MyDirectoryName\My_Savefile.sol
If you know better way or another solution, you can mail us and we will post it too.
Thanks and good luck, sincerely Kratavrat team!

1 comment: