The alias shouldn't really matter since you are writing the stream and reading 
it.  The alias matters when a server is sending data with those types in it.

I think because your class is based on Proxy, you may have to implement 
IExternalizable in order to get this to work.

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: Thursday, October 29, 2009 11:58 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: bytearray.readObject doesn't convert my objects back



This is what I have assuming I use the lib directory structure and not my app 
structure?

[RemoteClass(alias="flare.vis.data.DataList")]
public class DataList extends Proxy implements IEventDispatcher

The actual directory structure is(notice src):
[RemoteClass(alias="src.flare.vis.data.DataList")]
public class DataList extends Proxy implements IEventDispatcher

This didn't work. I tried going in and creating getters and setters for all 
protected and private properties which got some of the data back, but not all 
of it.

Jason

--- In flexcoders@yahoogroups.com<mailto:flexcoders%40yahoogroups.com>, Alex 
Harui <aha...@...> wrote:
>
> All sub-objects that are going to get serialized also need to have registered 
> aliases.
>
> Do a simple test with simpler data objects to see if it works for you.
>
> 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: Thursday, October 29, 2009 9:21 PM
> To: flexcoders@yahoogroups.com<mailto:flexcoders%40yahoogroups.com>
> Subject: [flexcoders] Re: bytearray.readObject doesn't convert my objects back
>
>
>
> I can't seem to get this to work saving to a SQLite3 database. The code works 
> writing (Data object contains 101 objects), but when reading the bytearray 
> the Data object ends up with 0 objects inside it. Its like it just returns a 
> new Data object. FYI, the Data object I am converting to a bytearray is 
> holder for other objects.
>
> Writing code:
> public function shouldPrepareDatasetAsByteArrayAndSaveToDB( data:Data ) : 
> String
> {
> registerClassAlias("flare.vis.data.Data", Data);
> var d:Data = data;
> var byteArray:ByteArray = new ByteArray();
> byteArray.writeObject(d);
> byteArray.position = 0;
>
> var base64Enc:Base64Encoder = new Base64Encoder();
> var str:String = '';
> base64Enc.encodeBytes( byteArray );
> str = base64Enc.toString();
>
> return str;
> }
>
> Reading code:
> private function shouldPrepareDatasUnWindByteArray( str:* ) : Data
> {
> var base64Dec:Base64Decoder = new Base64Decoder();
> base64Dec.decode( str );
> var byteArray:ByteArray = base64Dec.toByteArray();
> byteArray.position = 0;
> registerClassAlias("flare.vis.data.Data", Data);
> var data:Data = byteArray.readObject();
> return data;
> }
>
> --- In 
> flexcoders@yahoogroups.com<mailto:flexcoders%40yahoogroups.com><mailto:flexcoders%40yahoogroups.com>,
>  Alex Harui <aharui@> wrote:
> >
> > Did you call registerClassAlias or use [RemoteClass] metadata?
> >
> > 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: Wednesday, October 28, 2009 3:40 PM
> > To: 
> > flexcoders@yahoogroups.com<mailto:flexcoders%40yahoogroups.com><mailto:flexcoders%40yahoogroups.com>
> > Subject: [flexcoders] bytearray.readObject doesn't convert my objects back
> >
> >
> >
> > So I am using
> >
> > var myArray:Array = [someObjectOfTypeObject, someOtherObjectOfTypeObject ];
> >
> > bytearray.writeObject(myArray);
> >
> > var blah:Array = bytearray.readObject();
> >
> > Blah comes back with two Objects but not someObjectOfTypeObject they come 
> > back with generic "Objects" and no data inside?
> >
> > Anyone have a clue on this? someObjectOfTypeObject and 
> > someOtherObjectOfTypeObject are of a special type of Class in my app so
> > someOtherObjectOfTypeObject:FooClass.
> >
> > Why doesn't it put them back as the correct type?
> >
>

Reply via email to