WebOrb/Flex:如何调用 RemoteObject 返回的 RemoteClass 上的方法
我有一个 RemoteObject 返回“Schedule”类。我创建了一个客户端 RemoteClass 来映射到它。类实例的所有属性都很好。我只是不清楚如何调用类上的方法。我如何在开始日期调用设置器?
包classes.remote { [可绑定] [RemoteClass(alias="com.site.data.schedule.Schedule")] 公开课时间表 {
public var id:int;
public var modifydate:Date;
public var startdate:Date;
public var enddate:Date;
}
}
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;
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您无法从 Flex 应用程序中调用在服务器类上定义的方法。 AMF 仅支持数据的序列化,即属性或公共字段。如果您只想在返回对象后为其属性设置值,则可以像任何其他变量一样设置它们
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
我真的不明白这个问题。
您可以像在其他所有类中一样在此类上调用任何您想要的内容,[RemoteClass] 只是意味着您可以使用此类与服务器端通信。它将转换为您指定的类。
请注意:例如,如果您在客户端修改从服务器端接收的对象实例,则这不会传播到服务器端,您必须将其显式传输回服务器端。参数在客户端与服务器之间按值传递,而不是按引用传递。这是你关心的吗?
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 ?