I have a large flex application (the app) running on one server, and many small flex applications (widgets) running on another server, which are to be included in the app so that visually the user see's one continuous application. Due to proprietary third party software, this structure cannot be changed. I am looking for some way to allow the app and the widgets to communicate, allowing 开发者_如何学运维the app to make changes to the widgets and the the widgets to notify the app when events are triggered, so that user interaction is fluid and continuous.
There are a few related questions which indicate it's possible to do this by setting up event triggers and listeners. I am wondering if there is any standardized way to do this (the answers aren't very clear) or if anyone has developed a library or API to make this easier.
Something I've had success with is using javascript as a bridge between the swf files. It's a nightmare to debug but it works quite well. Check out the tutorial here for a quick discussion of how to interact with javascript from within flash and vice versa
I assume you are running your Flex apps on a client, not a server; is that correct? You want to swfs from multiple servers to act as single application, correct?
I believe that you can communicate between two swfs using LocalConnection:
http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/net/LocalConnection.html
The other questions you link to seem to talk about loading onw swf inside the oher; which is a separate approach.
Use Modules and ModuleLoaders. You'll be able to set the security context, and if you sublcass the Module class and add your own API, you can have a consistent way to communicate with your modules.
Check here for a simple Module: http://blog.flexexamples.com/2007/08/06/building-a-simple-flex-module/
精彩评论