WebOrb/Flex:如何调用 RemoteObject 返回的 RemoteClass 上的方法

发布于 2024-08-10 08:25:16 字数 419 浏览 2 评论 0原文

我有一个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

ㄟ。诗瑗 2024-08-17 08:25:16

您无法从 Flex 应用程序中调用在服务器类上定义的方法。 AMF 仅支持数据的序列化,即属性或公共字段。如果您只想在返回对象后为其属性设置值,则可以像任何其他变量一样设置它们

schedule.startDate = new Date();

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();
朱染 2024-08-17 08:25:16

我真的不明白这个问题。
您可以像在其他所有类中一样在此类上调用任何您想要的内容,[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 ?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文