apologies, as ivo has helpfully pointed out (and I'd forgotten, thanks ivo), you need to be using registerClassAlias() in order to be able to type the object you get back. so
var userVOasByteArray:ByteArray = result.data[0]["USER"] as ByteArray
;
userVOasByteArray.position = 0;
var user:Object = userVOasByteArray.readObject();
would give you user as a plain old object.
add the line
registerClassAlias("*", UserVO);
above
var userVOasByteArray:ByteArray = result.data[0]["USER"] as ByteArray
;
userVOasByteArray.position = 0;
var user:userVO = userVOasByteArray.readObject() as userVO;
and you should get an object typed as UserVO back, I hope anyway. (I made some
assumptions as to the package name there.)
The link ivo posted to the help file should get you going, there's more info
around if you google it.
I did say it was all off the top of my head!
-----Original Message-----
From: [email protected] on behalf of markflex2007
Sent: Mon 25/08/2008 20:50
To: [email protected]
Subject: [flexcoders] Re: How to save object to SQLite and get it back?
Hi,
I use the following code to read the data from sqlite
var userVOasByteArray:ByteArray = result.data[0]["USER"] as ByteArray
; userVOasByteArray.position = 0;
var user:userVO = userVOasByteArray.readObject() as userVO;
userVOasByteArray has data but user is null.
Do you know why this happens?
Thanks
Mark
______________________________________________________________________
This communication is from Primal Pictures Ltd., a company registered in
England and Wales with registration No. 02622298 and registered office: 4th
Floor, Tennyson House, 159-165 Great Portland Street, London, W1W 5PA, UK. VAT
registration No. 648874577.
This e-mail is confidential and may be privileged. It may be read, copied and
used only by the intended recipient. If you have received it in error, please
contact the sender immediately by return e-mail or by telephoning +44(0)20 7637
1010. Please then delete the e-mail and do not disclose its contents to any
person.
This email has been scanned for Primal Pictures by the MessageLabs Email
Security System.
______________________________________________________________________<<winmail.dat>>

