Search the web
Sign In
New User? Sign Up
flexcoders · RIA Development with Adobe Flex
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Want your group to be featured on the Yahoo! Groups website? Add a group photo to Flickr.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Typecast a generic Object into a VO   Message List  
Reply | Forward Message #53783 of 150922 |

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






Mon Oct 23, 2006 2:41 pm

mdoberenz
Online Now Online Now
Send Email Send Email

Forward
Message #53783 of 150922 |
Expand Messages Author Sort by Date

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...
mdoberenz
Online Now Send Email
Oct 23, 2006
3:39 pm

This Article in the CFDJ should be of help to you: http://it.sys-con.com/read/264726_1.htm http://it.sys-con.com/read/264726_2.htm As an aside, I'll be...
Darron J. Schall
darronschall
Offline Send Email
Oct 23, 2006
5:50 pm

Hi, I had the same type of problem (I'd like to have typed objects for my web service/http results) and would like to share my approach to get some feedback. ...
mockery42
Offline Send Email
Jun 11, 2007
12:46 pm

Nope, an instance must actually be of a particular type in order to coerce it to that type. Try adding metadata to your class: [RemoteClass(alias="TestVO")] ...
Peter Farland
pjfarland
Offline Send Email
Oct 23, 2006
5:54 pm

... Have you dump the object in the debugger / log file to check it's a real Test ? -- Tom Chiverton Helping to revolutionarily harvest network e-markets ...
Tom Chiverton
tom.chiverton
Offline Send Email
Oct 24, 2006
1:06 pm

... Yeah, this is the tradeoff for not using FDS. As I see this, Flex is unaware of the types passed thru SOAP from webservices. There is no automatic...
Sebastian Zarzycki
rattkined
Offline Send Email
Oct 24, 2006
8:05 pm

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...
Mark Doberenz
mdoberenz
Online Now Send Email
Oct 24, 2006
8:11 pm

Note you could do this generically for any type... as a quick hack, you could loop through the anonymous object provided in the constructor and set the...
Peter Farland
pjfarland
Offline Send Email
Oct 24, 2006
8:28 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help