First note that the client class must have the ability to be constructed
without any arguments, and then a setter will be called for each
property returned for that instance from the server. Any other
properties will remain in their default state on construction.
 
Some ideas... You can make your client AS class dynamic with well
defined setters and getters for the properties that will be set during
response deserialization - "dynamic" allows you to arbitrarily add
undeclared properties to an instance of that type (just like Object
does... and note the "dynamic" nature of a type is not inherited) at
runtime.
 
If you're worried that you'll need to send this type back to the server
and you don't want these newly added dynamic properties to be sent to
the server, then you could take a look at implementing
flash.utils.IExternalizable and take control of serialization completely
for your type. Or, you could simply declare that a particular concrete
property on your client type was "transient" using [Transient] metadata
- these properties wouldn't be included when instances were sent back to
the server.
 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Shaun
Sent: Tuesday, March 13, 2007 4:02 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Server vs Client Object



I assume that means there isn't a way to do this with objects? I 
would rather avoid XML, as objects would be considerably faster and 
smaller to work with.

Shaun

--- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
, "Tracy Spratt" <[EMAIL PROTECTED]> wrote:
>
> If you use the XML object, you can add attributes to it at will.
> 
> Tracy
> 
> 
> 
> ________________________________
> 
> From: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>

[mailto:flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
] On
> Behalf Of Shaun
> Sent: Tuesday, March 13, 2007 12:54 PM
> To: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> 
> Subject: [flexcoders] Server vs Client Object
> 
> 
> 
> I think this question probably has an obvious answer, but I want to
> make sure I am using something resembling best practices, so I 
decided
> I better ask:
> 
> If I have a server object that has a set of persistent properties, 
but
> on the client I want to add some temporary properties and/or logic,
> what is the best way to accomplish this? 
> 
> The problem is that I want to use RemoteObject to get my objects 
from
> the server, but I want them to have additional properties and/or
> functions when on the client.
> 
> Do only properties present on the server get populated on the 
client,
> with the others getting their default values?.. or will I have to
> create client side objects by copying values from generic server 
side
> objects?
> 
> Thanks for any help,
> Shaun
>



 

Reply via email to