Yes!  That's exactly what's happening!  So now I can do this in my VO
class:

class ExampleVO
{
    result:Object; // datatype will depend on what server returns!
    
    aString:String;
    aNumber:Number;

    function ExampleVO()
    {
        processResult();
    }

    private function processResult()
    {
        aString = String(result.aString);
        aNumber = parseInt(result.aNumber);
    }
}

Or something along these lines if I choose to do datatype conversion in
Flash.  Most of what I do is preprocessed into an object in php, and
with this pattern I can use my old code and the objects it returns and
deal with them in Flash instead of spending much time with it on the
server.  Although it would be best to just make it right on the server
in the first place. Again, thanks for this insight!  Just knowing that
the object is populated before the constructor is called and that those
properties take precedence over my class explains a lot.  Now I'm much
better prepared to handle what remoting throws at me :)


On Tue, 2006-08-29 at 18:17 +0200, Martin Wood wrote:
> Unfortunately the player wont do data type conversion when deserializing the 
> contents of an object returned via remoting.
> 
> You have to make sure your types are right on the server so that when the 
> remoting gateway constructs the amf data to send to flash it has the correct 
> types already inside.
> 
> Obviously this is more of a pain from something like PHP than say Java as PHP 
> has a much looser type system.
> 
> For me the beauty of remoting is that you *do* get the datatypes that you 
> create 
> on the server sent to you in flash.
> 
> I think the other issue you are running into is that when the player creates 
> the 
> actionscript objects from the remoting data it populates the object *before* 
> it 
> runs the constructor.
> 
> This means that it doesnt care about any getters / setters and you have to be 
> extra careful if you do anything in the constructor or are expecting 
> parameters 
> to your constructor.
> 
> 
> Julius Turnmire wrote:
> > Ok, I've got it working as advertised.  I'm using VO's and my returned
> > values are being mapped to my VO classes.  But the problem is how
> > they're mapped.
> _______________________________________________
> Flashcoders@chattyfig.figleaf.com
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> 
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.com
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to