views:

32

answers:

3

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.

A: 

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.

www.Flextras.com
They're located on two separate servers, the user loads the app in their browser, which in turn loads whatever necessary widgets it needs inside the flex app. I assumed the logical way to do that was to load the widget's swf inside the app, but maybe not?
dimo414
If you want to embed one app in the other; then use a SWFLoader just like is stated in the questions you link to. I'm unclear if their are any crossdomain restrictions w/ the SWFLoader. You can still use LocalConnection to communicate between the two SWFs
www.Flextras.com
+1  A: 

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

Chris Thompson
Very cool. Likely more complex that I need (I hope, anyways) but good to know, thanks!
dimo414
A: 

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/

Dusty J
And more info about cross-module communications:http://opensource.adobe.com/wiki/display/flexsdk/Marshall+Plan
Dusty J