A Transform's Matrix is essentially six or 9 numbers. You can simply save them as an array, read it back as an array and then instantiate the Matrix again.
Alex Harui Flex SDK Developer Adobe Systems Inc.<http://www.adobe.com/> Blog: http://blogs.adobe.com/aharui From: [email protected] [mailto:[email protected]] On Behalf Of jnewport Sent: Saturday, October 31, 2009 9:00 AM To: [email protected] Subject: [flexcoders] Re: bytearray.readObject doesn't convert my objects back How would I go about doing that? Would I need to null out the transform object first before converting to a bytearray? Here is my object structure I am trying to save: Data NodeDatalist (list of nodes like an array) Node (think graph or tree vertice) Nodedata ( children nodes, parent node) Visualdata ( transform etc) Node (think graph or tree vertice) Nodedata ( children nodes, parent node) Visualdata ( rendered, transform etc) n...... Edgedatalist Edge(think graph or tree vertice) Edgedata ( children nodes, parent node) Visualdata ( rendered, transform etc) Edgedata ( children nodes, parent node) Visualdata ( rendered, transform etc) n... Tree (tree structure data) --- In [email protected]<mailto:flexcoders%40yahoogroups.com>, Alex Harui <aha...@...> wrote: > > To handle classes like transform, I would come up with a custom encoding for > the transform (or skip it entirely as the transform can usually be derived > from other properties like scale, x, y, width, height, rotation). I didn't > know you were trying to serialize display objects. Generally that's not > advisable as there is a lot of redundancy and circular references in the > properties. It is better to save away the data they present and some notion > of which class to use to present the data. > > Alex Harui > Flex SDK Developer > Adobe Systems Inc.<http://www.adobe.com/> > Blog: http://blogs.adobe.com/aharui > > From: [email protected]<mailto:flexcoders%40yahoogroups.com> > [mailto:[email protected]<mailto:flexcoders%40yahoogroups.com>] On > Behalf Of flexaustin > Sent: Friday, October 30, 2009 6:08 PM > To: [email protected]<mailto:flexcoders%40yahoogroups.com> > Subject: [flexcoders] Re: bytearray.readObject doesn't convert my objects back > > > > Alex, first thanks for spending so much time helping me with this. > > How do I handle all the rest? Flex specific classes? Should I monkey patch? > See error below my custom object needs to have all this serialized and > dematerialized as well.: > > ArgumentError: Error #1063: Argument count mismatch on > flash.geom::Transform(). Expected 1, got 0. > > Jason > > --- In > [email protected]<mailto:flexcoders%40yahoogroups.com><mailto:flexcoders%40yahoogroups.com>, > Alex Harui <aharui@> wrote: > > > > Serialization requires that the constructor handle zero parameters. So just > > try: > > > > public function DataList(name:String = null) > > > > > > Alex Harui > > Flex SDK Developer > > Adobe Systems Inc.<http://www.adobe.com/> > > Blog: http://blogs.adobe.com/aharui > > > > From: > > [email protected]<mailto:flexcoders%40yahoogroups.com><mailto:flexcoders%40yahoogroups.com> > > > > [mailto:[email protected]<mailto:flexcoders%40yahoogroups.com><mailto:flexcoders%40yahoogroups.com>] > > On Behalf Of flexaustin > > Sent: Friday, October 30, 2009 11:42 AM > > To: > > [email protected]<mailto:flexcoders%40yahoogroups.com><mailto:flexcoders%40yahoogroups.com> > > Subject: [flexcoders] Re: bytearray.readObject doesn't convert my objects > > back > > > > > > > > I don't think so. Its just that it isn't just a generic simple Object or > > Array but rather a large Class file which contains other large class files. > > > > So imagine saving something like your entire displaylist, but not the > > visual just the data behind it. > > > > The object I am saving cotains over 100 over objects and these 100 objects > > contains a handful of objects. > > > > Jason > > > > --- In > > [email protected]<mailto:flexcoders%40yahoogroups.com><mailto:flexcoders%40yahoogroups.com><mailto:flexcoders%40yahoogroups.com>, > > "seanmcmonahan" <sean@> wrote: > > > > > > Do you think the class being dynamic is causing this issue? I ask because > > > I have a similar problem with a dynamic class that extends Dictionary. It > > > works fine in Flash Player 9.0.28 but not in 10. > > > > > > --- In > > > [email protected]<mailto:flexcoders%40yahoogroups.com><mailto:flexcoders%40yahoogroups.com><mailto:flexcoders%40yahoogroups.com>, > > > Alex Harui <aharui@> wrote: > > > > > > > > Yeah, I think that's because Proxy is an odd beast. It is dynamic and > > > > can have "any" property and you're responsible for implementing all > > > > those methods that help iterate the object. > > > > > > > > Alex Harui > > > > Flex SDK Developer > > > > Adobe Systems Inc.<http://www.adobe.com/> > > > > Blog: http://blogs.adobe.com/aharui > > > > > > > > From: > > > > [email protected]<mailto:flexcoders%40yahoogroups.com><mailto:flexcoders%40yahoogroups.com><mailto:flexcoders%40yahoogroups.com> > > > > > > > > [mailto:[email protected]<mailto:flexcoders%40yahoogroups.com><mailto:flexcoders%40yahoogroups.com><mailto:flexcoders%40yahoogroups.com>] > > > > On Behalf Of flexaustin > > > > Sent: Friday, October 30, 2009 9:40 AM > > > > To: > > > > [email protected]<mailto:flexcoders%40yahoogroups.com><mailto:flexcoders%40yahoogroups.com><mailto:flexcoders%40yahoogroups.com> > > > > Subject: [flexcoders] Re: bytearray.readObject doesn't convert my > > > > objects back > > > > > > > > > > > > > > > > > > > > Can't even use an JSON encoding > > > > > > > > at com.adobe.serialization.json::JSONEncoder/objectToString() > > > > > > > > jason > > > > > > > > --- In > > > > [email protected]<mailto:flexcoders%40yahoogroups.com><mailto:flexcoders%40yahoogroups.com><mailto:flexcoders%40yahoogroups.com><mailto:flexcoders%40yahoogroups.com>, > > > > "flexaustin" <flexaustin@> wrote: > > > > > > > > > > What about using the JSONEncoder and JSONDecoder? Will I have the > > > > > same issue? > > > > > > > > > > Jason > > > > > > > > > > > > > > > > > > > > --- In > > > > > [email protected]<mailto:flexcoders%40yahoogroups.com><mailto:flexcoders%40yahoogroups.com><mailto:flexcoders%40yahoogroups.com><mailto:flexcoders%40yahoogroups.com>, > > > > > "flexaustin" <flexaustin@> wrote: > > > > > > > > > > > > Just realized need return type. > > > > > > > > > > > > > > > > > > --- In > > > > > > [email protected]<mailto:flexcoders%40yahoogroups.com><mailto:flexcoders%40yahoogroups.com><mailto:flexcoders%40yahoogroups.com><mailto:flexcoders%40yahoogroups.com>, > > > > > > "flexaustin" <flexaustin@> wrote: > > > > > > > > > > > > > > Getting error > > > > > > > 1144: Interface method readExternal in namespace > > > > > > > flash.utils:IExternalizable is implemented with an incompatible > > > > > > > signature > > > > > > > > > > > > > > > > > > > > > public class Data extends EventDispatcher implements > > > > > > > IExternalizable > > > > > > > > > > > > > > public function writeExternal(output:IDataOutput) { > > > > > > > output.writeObject(_nodes); > > > > > > > output.writeObject(_edges); > > > > > > > output.writeObject(_span); > > > > > > > output.writeObject(_groups); > > > > > > > output.writeObject(_root); > > > > > > > output.writeObject(_tree); > > > > > > > } > > > > > > > public function readExternal(input:IDataInput) { > > > > > > > _nodes = input.readObject(); > > > > > > > _edges = input.readObject(); > > > > > > > _span = input.readObject(); > > > > > > > _groups = input.readObject(); > > > > > > > _root = input.readObject(); > > > > > > > _tree = input.readObject(); > > > > > > > } > > > > > > > > > > > > > > > > > > > > > > > > > > > >

