1 Reply Latest reply on May 6, 2011 8:42 AM by UbuntuPenguin

    mapping actionscript objects to java objects


      hi guys,

      so i'm trying to retrieve data from database based on the word clicked.


      here's my code.


      this is my result handler for the remote object



      public function resultHandler1(event:ResultEvent):void



      Alert.show("result hander for remote object can work");

      var wc: WordClicked =  WordClicked(event.result);



      Alert.show("I am until here, where are you" + wc + " " + wc.post);



      this is my WordClicked.as class

      package services









      public class WordClicked



      public var user:String;

      public var post:String;


      // getter and setters


      public function get post():String


      return _post;



      public function set post(value:String):void


      _post = value;



      public function get user():String


      return _user;



      public function set user(value:String):void


      _user = value;










      i am able to print out the word being clicked on the console.

      however, i can't show the word being clicked in a Alert box.

      did i do the object mapping from actionscript class to my java class wrongly?




        • 1. Re: mapping actionscript objects to java objects
          UbuntuPenguin Level 4

          Yeah, there is something awry with your mapped classes.  You don't use the java source files to map your classes, you use AS3

          classes that are designated to which classes they map to on the backend.  Observe..


          package shared.servicevos

             import flash.events.EventDispatcher;

             import flash.events.IEventDispatcher;




             public class ShopperVO


                 public var shopperId:int;

                 public var shopperLocation:String;

                 public var shopDate:Date;

                 public var shopperAddress:Address



          If you notice the the metadata beginning with "RemoteClass", I am telling Flex "when you see an object that comes in with this type "alias" it is should be made into a ShopperVO".  On the backend, I have a folder with a directory structure of /amf and it contains a ShopperVO.java class.


          P.S This isn't exactly the setup I am working with cause I am using php, but the ideas are the same.