loading robotlegs project (swf) into robotlegs project
Hello! I want to load robotlegs project (swf file) into main robotlegs project. I don't need any connection between them. Main robotlegs project will call some public function in swf file. When I try to load an swf file in main project the ContextEvent.STARTUP_COMPLETE event fires from loaded swf and triggers startup command in main project again. What is the correct approach to load swf file into robotlegs project? Please...
Comments are currently closed for this discussion. You can start a new one.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
Support Staff 1 Posted by Shaun Smith on 10 Mar, 2012 02:17 PM
Hello Perconte,
That shouldn't happen. Each application has its own, isolated event dispatcher so dispatching STARTUP_COMPLETE on one should not affect the other at all.
However it's possible that mediators mapped in the main application are attaching to views present in the loaded swf (if the loaded swf is being added "inside" the main application's contextView). So, I would take a look into that and see if this is causing any unintended side effects.
Support Staff 2 Posted by Ondina D.F. on 11 Mar, 2012 10:06 AM
Hi Perconte and Shaun,
That happens indeed, when the settings for the ApplicationDomain look like in Usage C from the following example:
http://livedocs.adobe.com/flex/3/html/18_Client_System_Environment_...
Usage A:
var appDomainA:ApplicationDomain = new ApplicationDomain();
Usage B:
var appDomainB:ApplicationDomain = ApplicationDomain.currentDomain;
Usage C: „This technique lets loaded modules share the loader's singleton objects and static class members.“
var appDomainC:ApplicationDomain = new ApplicationDomain(ApplicationDomain.currentDomain);
var context:LoaderContext = new LoaderContext(false, appDomainC);
var loader:Loader=new Loader();
loader.loadBytes(urlLoader.data, context);
container.addChild(loader);
3 Posted by Perconte on 11 Mar, 2012 10:36 AM
Thank you Shaun for the respond! Silly to admit but I forgot to set ApplicationDomain when loading the swf file. So the loaded swf file was using the classes with the same name from the main project as they had the same namespace :) So it caused unpredictable behavior. Maybe it will help someone too.
4 Posted by Perconte on 11 Mar, 2012 10:39 AM
Sorry Ondina, I didn't noticed your respond my browser was opened and I didn't refresh it :) Thank you all for the help! ;)
Support Staff 5 Posted by Ondina D.F. on 13 Mar, 2012 01:09 PM
You're welcome:)
Ondina D.F. closed this discussion on 13 Mar, 2012 01:09 PM.