Just pull off the properties.  If you didn’t do a registerClass you’ll get a regular object back that should have the properties for anything where you had a getter in your Java class.

 

Matt

 


From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of cruegger2000
Sent: Wednesday, August 03, 2005 9:41 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] accessing returned ValueObject properties in mxml file

 


I want to access the properties of a Value Object returned from a
Java business delegate to populate some flex controls (label text,
grid data, etc.).  However, I do not want to have to write an
analogous Value Object class in ActionScript code (don't want to have
to keep them in synch). Is this possible? If so, how? I have not been
able to find documentation that addresses this.

Here are background details:

On the server side I have:
--------------------------
public class HelloDelegate
{
  public HelloVO getHello()
  {
    return new HelloVO();
  }
}
public class HelloVO implements Serializable
{
  private int id;
  private String name;
  // get accessors for id and name
}

On the client side I have:
--------------------------
hello.mxml:
  <mx:RemoteObject id="helloDelegate" type="stateless-class"
      result="event.call.resultHandler(event.result)"
      source="com.delegate.hello.HelloDelegate">
    <mx:method name="getHello"/>
  </mx:RemoteObject>

  <mx:Panel title="Hello App">
  <mx:Button label="Invoke Hello Service" click="getHello()"/>
  </mx:Panel>

  public function getHello():Void
  {
    var pendingCall = helloDelegate.getHello();
    pendingCall.resultHandler =
      mx.utils.Delegate.create(this,gotHello);
  }
  private function gotHello(result) : Void
  {
    // At this point result is a HelloVO value object. How can I
    // access id and name properties here?
  }











--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




YAHOO! GROUPS LINKS




Reply via email to