Storing Typed Objects in Flex’s Local Shared Objects
Flex’s Local Shared Objects provide a convenient way to persist data on the client, in a similar way that cookies are used in web applications. Shared Objects are much more powerful however, allowing the persisting of structured data, with a default client set limit of 100kB of storage.
Typed objects can be added to the store by setting properties of the Shared Object’s data property to the value of the typed object (Example). However by default, when the object is read from the store, it will lose its type information and cannot be cast to type either. To make the object retain its class info, you must register the class before persisting. This is done using the registerClassAlias function. This is called with the full class name (package.Class) and the class itself.
Each class and sub-classed of the object must be registed this way, if you want to persist complex objects such as Value Objects and Presentation Objects (used with a presentation model). The easiest way to achieve this is to add the [RemoteClass] meta data to each class definition.
