开发者

In flex how do I pass data retrieved from a remote object service to a modules interface?

I found at this Adobe tutorial a nice "RemoteService" class that creates a RemoteObject and contains the functions for handling the result and fault events. If I wanted to use this approach, how could I pass the data from the result handler to interfaces that modules from the main application could use?

I could put the RemoteService/RemoteObject in the modules, but (in my opinion- and I could be wrong) the best design seems to be using the remote calls in the main app and passi开发者_开发技巧ng the data along to the modules.


I think you're correct -- have the remote calls in the main app if other parts of the app will need the data.

To get data into the module, just set a property of the module to the data. So a result handler in the main app sets myModule.someObject = event.result.someObject.

To get data from the module back to the app, dispatch an event. This way the module is loosely coupled to whoever its host is.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜