views:

350

answers:

2

I have a RemoteObject returning a 'Schedule' class. I've created a client side RemoteClass to map to it. All properties of the class instance are coming in fine. I just not clear on how I go about calling methods on the class. How would I call a setter on startdate?

package classes.remote { [Bindable] [RemoteClass(alias="com.site.data.schedule.Schedule")] public class Schedule {

 public var id:int; 


 public var modifydate:Date;
 public var startdate:Date;
 public var enddate:Date;


}

}

A: 

I don't really get the question. You can call whatever you want on this class like in every other class, The [RemoteClass] just means you can use this class in communication with the server side. It will be converted to the class you specified. Beware: For example, if you modify your instance of the object in the client side that received from the server side, this won't propagate to the server side, you will have to explicitely transfer it back to the server side. The parameters are passed by value and not by reference between client<=>server. Is it your concern ?

Julien Nicoulaud
Yes, that's my concern. I want to access setters on the server side.
John Leonard
Why would you want to access setters on the server side from within your flex application?
Lieven Cardoen
A: 

You cannot invoke methods that are defined on the server class from within a Flex application. AMF only supports serialization of data, i.e. properties or public fields. If you just want to set values to the properties of the object after it's been returned, you set them like any other variable

schedule.startDate = new Date();
cliff.meyers