Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint

29.7. Storing Custom Classes

Using a SharedObject, you can store any native type in ActionScript 3.0 persistently. You can also store your own custom classes, with a little bit of extra work. The extra work has to do with the process of encoding objects into bytes so that they can be written to the local shared object file. Encoding objects into a flat binary representation is called serialization, and restoring them into their original form as runtime objects is called deserialization. You've already seen that Flash Player uses AMF to serialize and deserialize objects for storage in shared objects.

29.7.1. Storing Custom Classes without Modification

Certain kinds of classes can be serialized and deserialized in AMF with no problem. You can store and retrieve instances of a class in a SharedObject without additional code as long as:


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial