--- In flexcoders@yahoogroups.com, "Mike" <msl...@...> wrote:
>
> I recently did something like this for Cisco.  They needed a way for a 
> sub-Application to invoke a method in another sub-Application, which might 
> not be loaded.  The solution was to derive the sub-Applications from a common 
> base class and use the main Application as a broker.  The broker listened to 
> function invocation request events.  Results of the method calls were made 
> available by a custom event that was dispatched by the called method upon 
> completion.
> 
> Here is a clue to how to implement this type of mechanism: the SWFLoader that 
> loads a sub-Application has a property called content, which is actually the 
> sub-Application's FlexGlobals.topLevelApplication once the sub-Application 
> loads.
> 
> Confused? I created a UML sequence diagram, a static object model diagram and 
> a text narrative to document how the mechanism worked.  Anyone else 
> attempting something similar is well advised to do the same.

There's an example on flexdiary.blogspot.com of how to cast a loaded swf to an 
Interface.  You may find that using a Dependency Injection Framework such as 
Robotlegs simplifies this to the extent you don't need so much documentation.  
Once you understand how the EventDispatcher backbone (or Event bus, as they 
like to call it) works, everything's really intuitive.  Check out 
http://insideria.com/2010/05/pass-the-eventdispatcher-pleas.html.

HTH;

Amy

Reply via email to