Yup, I do do registerClass.  Wouldn't work without ;)  I'll check out
your article, but as far as I can tell everything is working it's just
overwritting the variables in my class..

On Tue, 2006-08-29 at 18:07 +0200, eka wrote:
> Hello :)
> 
> do you use Object.registerClass method to register your VO  classes in
> ActionScript ?
> 
> You can read in french my article about Class Mapping (AS2 and AS3) and
> fixing bug in AS3 in my blog :
> 
> http://www.ekameleon.net/blog/index.php?2006/08/28/48--amf-class-mapping-difficile-en-as3
> 
> Sorry, the article is write in French ! but the ActionScript and PHP codes
> are easy ;)
> 
> EKA+ :)
> 
> 
> 
> You can use Google translator or babelFish
> 
> 2006/8/28, Julius Turnmire <[EMAIL PROTECTED]>:
> >
> > 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.
> >
> > I decided to work on getting VO's to work in my project in the hopes
> > that all the string values I get from MySQL would be mapped to their
> > proper datatypes.  But it didn't quite work the way I had hoped. The
> > returned values do not get put into the VO class as the datatypes that
> > are assigned in the class, they get put in as the datatypes that are
> > returned from PHP.
> >
> > For instance..
> >
> > PHP service class:
> >
> > <?php
> >
> > class SimpleService
> > {
> >
> >     function SimpleService()
> >     {
> >         $this->methodTable = array(
> >             "tester" => array(
> >                 "description" => "tester() :: returns examples",
> >                 "arguments" => array(),
> >                 "access" => "remote",
> >                 "returns" => "TesterVO"
> >             )
> >          );
> >     }
> >
> >     function tester()
> >     {
> >         $TesterVO = array('aString' => 12345, 'aNumber' => '12345');
> >         return $TesterVO;
> >     }
> > }
> >
> > ?>
> >
> >
> > Flash VO class:
> >
> > class TesterVO
> > {
> >
> >     aString:String;
> >     aNumber:Number;
> >
> >     function TesterVO()
> >     {
> >     }
> >
> > }
> >
> > In this example aString doesn't get mapped to a String, and aNumber
> > doesn't get mapped to a Number.  aString becomes a Number and aNumber
> > becomes a string.  Well, I wouldn't normally return types like this, but
> > I was really hoping to avoid converting strings to numbers, and also the
> > "1" string that you get when MySql returns a TRUE.
> >
> > So, I figure that it's all ok..  I'll use getters/setters.  So I set up
> > those methods in my class, for instance:
> >
> > ...
> >     __aNumber:Number;
> >
> >     function set aNumber(newNum):Void
> >     {
> >         __aNumber = parseInt(newNum);  //ie  parseInt("12345");
> >     }
> >
> >     function get aNumber():Number
> >     {
> >         return __aNumber;
> >     }
> > ...
> >
> >
> > Guess what happens... my setter basically gets overwritten with
> > aNumber:String = "12345"..  And my getter returns undefined because the
> > setter never set __aNumber!  I was under the assumption that the whole
> > purpose of VO's was so that datatypes get typed properly..  But the way
> > Flash works, it just overwrites the properties with what's returned.
> >
> > Now I know I can work around all this, but doesn't it really defeat the
> > purpose of all of it all?  Aren't Value Object's properties supposed to
> > use the datatypes that they define?  Am I missing something?  All does
> > work fine when the returning types correspond.  When array('aNumber' =>
> > 123, 'aString' => "123JustaString", 'aBoolean' => true) is returned I do
> > get those datatypes.  There's no need to even set the datatypes as it
> > really wont matter when flash gets a hold of it.
> >
> > Another thing, but it's minor, is that in this case:
> >
> > function onResult(myResult:ResultEvent)
> > {
> >     var theResult:TesterVO = myResult.result;
> > }
> >
> > Flash will error on compile.  It really thinks that myResult.result will
> > be of the datatype Object.  Shouldn't they have left that untyped?
> >
> > Now before you think that my VO's really aren't getting mapped, they
> > are.  I've made sure of that, any methods I put in that class are
> > accessible upon receiving data from the server..
> >
> > Any thoughts?  Am I missing something?  I've been very happy with
> > remoting, and have been using it with great success for some time now.
> > But, I was really hoping that spending the time to get VO's working
> > would be worth it.  Boy was I disappointed.  It just seems to be more
> > work then what it's worth.
> >
> >
> > _______________________________________________
> > 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
_______________________________________________
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