View Full Version : Shared Object Type
TacoRock
10-09-2008, 06:35 PM
When i save an object from a class i made into a SharedObject, it disappears if i reload the SWF. Is it possible to store an object from a class I made in a SharedObject and keep it on the local machine? If not, is there any other way to save it (besides saving all the primitives in it)?
ex:
var sO:SharedObject = SharedObject.getLocal("Data0");
var someObj:SomeClassIMade = new SomeClassIMade();
sO.data.myObject(someObj);
//Then reload and have it still in there.
xxneon
10-09-2008, 06:44 PM
you would want to assign it like this..
sO.data.myObject = someObj;
the flash help says that you can assign any Actionscript or Javascript type object to a data.parameterName.. but i am nore sure if that is only built in classes .. or if you can do that with custom class instances too.
TacoRock
10-09-2008, 06:56 PM
oops, sorry that's what i meant to type:
"sO.data.myObject = someObj;"
yeah, whenever i reload the swf, sO.data.myObject becomes undefined, but all my primitives i store in there (ex: sO.data.anInteger = 5) are still in there. I could break the myObject class into primitives and store it like that i guess, but that's a lot of work O_O...
xxneon
10-09-2008, 07:26 PM
I think you can only store Flash Built in classes.. that are considered basic objects.. like i doubt you can store a Sprite instance to a shared object.. they list a bunch of acceptable class objects that you can store to the shared object.. all of which look like they are internal classes that can be translated as primitives internally..
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.