tag:robotlegs.tenderapp.com,2009-10-18:/discussions/problems/505-loading-robotlegs-project-swf-into-robotlegs-projectRobotlegs: Discussion 2012-03-13T13:09:27Ztag:robotlegs.tenderapp.com,2009-10-18:Comment/143854722012-03-10T12:53:37Z2012-03-10T12:53:38Zloading robotlegs project (swf) into robotlegs project<div><p>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...</p></div>Percontetag:robotlegs.tenderapp.com,2009-10-18:Comment/143854722012-03-10T14:17:47Z2012-03-10T14:17:47Zloading robotlegs project (swf) into robotlegs project<div><blockquote>
<p>the ContextEvent.STARTUP_COMPLETE event fires from loaded swf
and triggers startup command in main project again</p>
</blockquote>
<p>Hello Perconte,</p>
<p>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.</p>
<p>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.</p></div>Shaun Smithtag:robotlegs.tenderapp.com,2009-10-18:Comment/143854722012-03-11T10:06:42Z2012-03-11T10:06:42Zloading robotlegs project (swf) into robotlegs project<div><p>Hi Perconte and Shaun,</p>
<blockquote>
<p>the ContextEvent.STARTUP_COMPLETE event fires from loaded swf
and triggers startup command in main project again</p>
</blockquote>
<p>That happens indeed, when the settings for the ApplicationDomain
look like in <em>Usage C</em> from the following example:</p>
<p><a href=
"http://livedocs.adobe.com/flex/3/html/18_Client_System_Environment_5.html">
http://livedocs.adobe.com/flex/3/html/18_Client_System_Environment_...</a></p>
<p>Usage A:<br>
var appDomainA:ApplicationDomain = new ApplicationDomain();</p>
<p>Usage B:<br>
var appDomainB:ApplicationDomain =
ApplicationDomain.currentDomain;</p>
<p><strong>Usage C</strong>: „This technique lets loaded
modules share the loader's singleton objects and static class
members.“</p>
<p>var <strong>appDomainC</strong>:ApplicationDomain = new
ApplicationDomain(ApplicationDomain.currentDomain);</p>
<p>var context:LoaderContext = new LoaderContext(false,
<strong>appDomainC</strong>);<br>
var loader:Loader=new Loader();<br>
loader.loadBytes(urlLoader.data, context);<br>
container.addChild(loader);</p></div>Ondina D.F.tag:robotlegs.tenderapp.com,2009-10-18:Comment/143854722012-03-11T10:36:31Z2012-03-11T10:36:31Zloading robotlegs project (swf) into robotlegs project<div><p>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.</p></div>Percontetag:robotlegs.tenderapp.com,2009-10-18:Comment/143854722012-03-11T10:39:03Z2012-03-11T10:39:04Zloading robotlegs project (swf) into robotlegs project<div><p>Sorry Ondina, I didn't noticed your respond my browser was
opened and I didn't refresh it :) Thank you all for the help!
;)</p></div>Percontetag:robotlegs.tenderapp.com,2009-10-18:Comment/143854722012-03-13T13:09:26Z2012-03-13T13:09:26Zloading robotlegs project (swf) into robotlegs project<div><p>You're welcome:)</p></div>Ondina D.F.