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]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/