This will help explain the binding warning:
http://www.cflex.net/showfaq.cfm?Object=faq&channelID=1&faqtype=&defaultfields=&defaultValues=#Question366
Essentially you need to cast the binding expression:
text="{Number(ApplicationPerson.phones[0].number)}"
Tracy
-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of
Christoph Guse
Sent: Friday, June 03, 2005 11:57 AM
To: [email protected]
Subject: Re: [flexcoders] complex Remote Objects
Hi Peter,
I've used Object.registerClass on Phones and Person.
I didn't really test if the type information is lost. But if I access an
Array member directly, i.e. ApplicationPerson.phones[0].number I get a
warning:
"1 Warning found.
Warning /WEB-INF/flex/user_classes/personen/PersonInfo.mxml:171
Changes to unknown property, number, will not be detected.
170:
171: <mx:Label text="{ApplicationPerson.phones[0].number}" />
172:
"
Despite this warning the access works and gets a result. I have checked
my VOs several times and I took the variables of of what Java2AS generates.
The "flat-cast-phenomenon" occurs in my app only with arrays. If I put
another custom object in Person I can access it without any problem.
Greets
Christoph
Peter Farland wrote:
> If you've used Object.registerClass on both Phones and Person classes
> there should be no problem with them being returned in an Array (that
> is, the Flash Player creates the Phones instances during
> deserialization no matter how deeply nested).
>
> When you say:
>
> "There are objects in ApplicationPerson.phones but it seems the
> information which type of objects are in it is gone."
>
> How do you test that this type information is lost? You could add a
> method to the Phones class, such as:
>
> class Phones{
> public var number:String;
> public var info:String;
>
> public function test():String {
> return ("My info is: " + info);
> }
> }
>
> Then call .test() on an Array member that is supposed to be of type
> "Phones" - if the call succeeds then you have an instance of Phones,
> if not, then perhaps you just have a generic Object.
>
> If the call did succeed, then perhaps you've uncovered a bug (possibly
> in DataGrid and its interaction with deserialized objects)? Let me
> know how the test goes and I'll pass on to QA to test.
>
>
> -----Original Message-----
> From: [email protected] [mailto:[EMAIL PROTECTED]
> On Behalf Of Christoph Guse
> Sent: Friday, June 03, 2005 10:50 AM
> To: [email protected]
> Subject: [flexcoders] complex Remote Objects
>
> Hi List,
>
> I use some complex Remote Objects. Let me give an example:
>
> class Phones{
> public var number:String;
> public var info:String;
> }
>
> class Person{
>
> public var name:String;
> public var firstname:String;
> public var phones:Array;
>
> }
>
> These are only example classes. In my app they are more complex and of
> course I uses Object.registerClass().
>
> The phones array in the Person class contains some Phones Objects. Let's
> say I have a Person object ApplicationPerson in my app and
> ApplicationPerson is filled with values by a remote call. There is
> absolutely no problem to access ApplicationPerson.name and
> ApplicationPerson.firstname, but when I try to fill a DataGrid with
> ApplicationPerson.phones nothing is shown. There are objects in
> ApplicationPerson.phones but it seems the information which type of
> objects are in it is gone.
> The only possibility I found to access ApplicationPerson.phones is to
> put a getPhones method in the class Person in which I cast every item in
> phones. getPhones could look like this:
>
> public function getPhones():Array{
> var ret:Array = new Array();
> for(var i=0; i < phones.length; i++){
> ret.push(Phones(phones[i]);
> }
> return ret;
> }
>
> Is a explicit getter-method the onliest chance to deal with complex
> Remote Objects or is there a possibility of "deep-cast" Flex does on its
> own?
>
> Greets
> Christoph
>
>
> --
> ****************************************
> Christoph Guse
> L�hstra�e 34
> 41747 Viersen
> Tel. 0 21 62 / 50 24 066
> Mobil 01 72 / 160 74 84
> VoIP 0 12 12 / 39 64 48 831
> ****************************************
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
> ------------------------------------------------------------------------
> *Yahoo! Groups Links*
>
> * To visit your group on the web, go to:
> http://groups.yahoo.com/group/flexcoders/
>
> * To unsubscribe from this group, send an email to:
> [EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>
>
> * Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> Service <http://docs.yahoo.com/info/terms/>.
>
>
--
****************************************
Christoph Guse
L�hstra�e 34
41747 Viersen
Tel. 0 21 62 / 50 24 066
Mobil 01 72 / 160 74 84
VoIP 0 12 12 / 39 64 48 831
****************************************
Yahoo! Groups Links
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/