I figured it out. I just made the VO have a constructor that set the values if you wanted to convert it to a VO:
public class TestVO
{
[Bindable] public var i_test:int;
[Bindable] public var o_test:Object;
[Bindable] public var s_test:String;
public function TestVO(obj:Object=null):void{
if (obj != null){
if (obj.hasOwnProperty("i_test"))
i_test = obj.i_test;
if (obj.hasOwnProperty("o_test"))
o_test = obj.o_test;
if (obj.hasOwnProperty("s_test"))
s_test = obj.s_test;
}
}
}
Later,
{
[Bindable] public var i_test:int;
[Bindable] public var o_test:Object;
[Bindable] public var s_test:String;
public function TestVO(obj:Object=null):void{
if (obj != null){
if (obj.hasOwnProperty("i_test"))
i_test = obj.i_test;
if (obj.hasOwnProperty("o_test"))
o_test = obj.o_test;
if (obj.hasOwnProperty("s_test"))
s_test = obj.s_test;
}
}
}
Later,
Mark
On 10/23/06, mdoberenz <[EMAIL PROTECTED]> wrote:
I'm pretty sure this is possible, but I can't get it to work.
I'm wanting to typecast a generic object that gets returned by a
WebService call into a VO, but I'm having some issues.
Say I have a VO of the following:
public class TestVO{
[Bindable] public var i_test:int;
[Bindable] public var s_test:String;
[Bindable] public var o_test:Object;
}
Then I get an object back from a WebService call that has a similar
structure, can't I just do the following?:
var typeCastTry:TestVO = RETURN_OBJ as TestVO;
When I do this, typeCastTry gets set to null.
Any help would be awesome!
Mark
__._,_.___
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
![]()
SPONSORED LINKS
Software development tool Software development Software development services Home design software Software development company
Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe
__,_._,___
- Re: [flexcoders] Typecast a generic Object into a VO Sebastian Zarzycki
- Re: [flexcoders] Typecast a generic Object into a ... Mark Doberenz
- RE: [flexcoders] Typecast a generic Object int... Peter Farland
Reply via email to

