This content has been marked as final. Show 6 replies
In a nutshell, yes. You should read the documentation on ApplicationDomain - there are several ways to go with it so you should read about and then decide. Much of it has to do with security, but also how classes and definitions are shared.
Is there a good example of a parent application loading a child application and the child application referencing a object in the parent application? I can find the other way around, and I don't understand 100% the documentation. I really need to get his figured out to move forward :(
Hey Ukie [or anyone], did you ever find a good example of a parent app loading a child app and the child app referencing an object in the parent app? I am in great need of this right now.
Let me see if i get your question...... You have a flex application and with in that application you are loading a .swf of another flex applicaiton into it.......and you want to comunicate between the both of them.....if this is correct i did this by using flash.net.LocalConnection
If the SWF you are loading is also an ActionScript 3 SWF (eg, built for Flex 2) then you can access the contents (variables and functions) directly - but only if they are in the same security sandbox.
Suppose you have loaded the second app using the SWFLoader named app2. When that has completed loading (it will dispatch an Event.COMPLETE event), the second application is available using the content property of the app2. The content should be of type SystemManager and it has an application property which can be cast to the class of the second application (eg, MyApp2 if that app's main file was MyApp2.mxml).
Caveat: I'm writing this from memory so you may have to look up some of these things in case I'm mis-remembering. But you can do it, it was designed to be done.
If you are loading an ActionScript 2 SWF, then you have to use LocalConnection.
For Flex 2, you might consider using Modules instead of SWFLoader because Modules are easier to use. I have an example on my blog.
Thank you, Peter! I have begun to implement modules and it is working out wonderfully! Thanks again!