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: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf 
Of flexaustin
Sent: Friday, October 30, 2009 6:08 PM
To: flexcoders@yahoogroups.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 flexcoders@yahoogroups.com<mailto:flexcoders%40yahoogroups.com>, Alex 
Harui <aha...@...> 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: flexcoders@yahoogroups.com<mailto:flexcoders%40yahoogroups.com> 
> [mailto:flexcoders@yahoogroups.com<mailto:flexcoders%40yahoogroups.com>] On 
> Behalf Of flexaustin
> Sent: Friday, October 30, 2009 11:42 AM
> To: flexcoders@yahoogroups.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 
> flexcoders@yahoogroups.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 
> > flexcoders@yahoogroups.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: 
> > > flexcoders@yahoogroups.com<mailto:flexcoders%40yahoogroups.com><mailto:flexcoders%40yahoogroups.com>
> > >  
> > > [mailto:flexcoders@yahoogroups.com<mailto:flexcoders%40yahoogroups.com><mailto:flexcoders%40yahoogroups.com>]
> > >  On Behalf Of flexaustin
> > > Sent: Friday, October 30, 2009 9:40 AM
> > > To: 
> > > flexcoders@yahoogroups.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 
> > > flexcoders@yahoogroups.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 
> > > > flexcoders@yahoogroups.com<mailto:flexcoders%40yahoogroups.com><mailto:flexcoders%40yahoogroups.com><mailto:flexcoders%40yahoogroups.com>,
> > > >  "flexaustin" <flexaustin@> wrote:
> > > > >
> > > > > Just realized need return type.
> > > > >
> > > > >
> > > > > --- In 
> > > > > flexcoders@yahoogroups.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();
> > > > > > }
> > > > > >
> > > > >
> > > >
> > >
> >
>

Reply via email to