I believe this also necessary when passing typed objects between SWFs using 
LocalConnection.

Dirk.

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] Behalf Of Peter 
Farland
Sent: Thursday, June 09, 2005 6:00 AM
To: [email protected]
Subject: RE: [flexcoders] complex Remote Objects


Yep - Matt's diagnosis is correct. Your OgoPhoneVO constructor might look 
something like this to make sure it doesn't override the initial states of the 
deserialized result objects:

    public function OgoPhoneVO()
    {
        if (info === undefined)
        {
            info = "";
            number = "";
            telephoneId = null;
            type = "";
        }
    }

This is necessary for any VO that is expected to be populated from native Flash 
Player object deserialization, e.g. instances of registered classes from 
RemoteObject that are encoded using AMF.

It's unfortunately that an example of this is not in the Flex 1.5 documentation 
- the topic will be improved in Flex 2.0.

Note: While it's taken me a while to come around on this issue, I personally 
don't believe this functionality "sucks"... it is a deliberately designed 
function of the Flash Player's native object deserialization (be it from LSOs, 
AMF, RTMP). It allows you to get access to the remote variables during object 
initialization (as you can't send constructor arguments via AMF).





From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Matt 
Chotin
Sent: Wednesday, June 08, 2005 9:12 PM
To: [email protected]
Subject: RE: [flexcoders] complex Remote Objects


Hi Christophe,
 
I bet the bug is because you have the constructor doing initial value 
assignment.  Joe Berkovitz posted a very detailed account of how Flex will 
screw you up if you do this in your VOs because the constructor is actually 
called AFTER all the variables have been assigned.  Pete then gave an 
explanation as to why we do this, which I forget.  In any case, it sucks.  So 
in your VO objects make sure that you don't assign default values to the 
properties in your constructor (or if you must put checks in the constructor to 
make sure the value hasn't already been defined).
 
HTH,
Matt
 



From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of 
Christoph Guse
Sent: Wednesday, June 08, 2005 10:36 AM
To: [email protected]
Subject: Re: [flexcoders] complex Remote Objects
 
Hi Peter,

I still have the problem with my complex Remote Objects. Here is some code and 
other stuff:





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 the Yahoo! Terms of Service. 


 
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/
 


Reply via email to