views:

533

answers:

2

I know its possible to save an object (and all subclasses, arrays, strings) into a Flash LSO, locally to a user's computer.

Is it possible to save a MovieClip or a Function?

I tried once with MovieClips, but it just stored the reference (pointer) to the MovieClip into the LSO and therefore it was unable to retrieve the whole MovieClip binary data back again.

+1  A: 

It is not possible to "copy" and by that not to save objects that inherit from displayObject.

the best solution is to extract the bitmap data save that and write your own parser for saving data that shapes the movieclip. other than that i didn't found any solution

Andy Jacobs
A: 

You need to write your own version of a deepCopy function. This function should introspect your MovieClip and remember all of it's properties and current state, as well as record the class name using getQualifiedClassName(). You would then save all that information to an LSO, so you can rebuild or duplicate the object later.

When you need to reconstitute it you would do the reverse. Get the LSO, create a new object of the same type and set all of it's properties to the saved states that you recorded earlier.

Another thing you can look into is saving the object out to a bytearray, but that will not save the type of your object, and may give you other problems.

Joshua Bloom