tag:robotlegs.tenderapp.com,2009-10-18:/discussions/problems/699-external-swf-module-in-flex-module-loader-and-popupmanagerRobotlegs: Discussion 2012-12-20T12:41:43Ztag:robotlegs.tenderapp.com,2009-10-18:Comment/227674482012-12-17T14:32:40Z2012-12-17T14:32:40ZExternal SWF Module in Flex Module Loader and PopupManager<div><p>Hi thexeb,</p>
<p>You need to create the mediator manually.</p>
<p>See here:<br>
<a href=
"http://knowledge.robotlegs.org/kb/reference-mvcs-implementation/how-to-mediate-a-flex-popup">
http://knowledge.robotlegs.org/kb/reference-mvcs-implementation/how...</a></p>
<p>hth<br>
Ondina</p></div>Ondina D.F.tag:robotlegs.tenderapp.com,2009-10-18:Comment/227674482012-12-17T15:10:19Z2012-12-17T15:10:19ZExternal SWF Module in Flex Module Loader and PopupManager<div><p>OK, I was too fast:) The context of your module is not
initialized because the module is not added to the stage, but to
the SystemManager.</p></div>Ondina D.F.tag:robotlegs.tenderapp.com,2009-10-18:Comment/227674482012-12-17T15:28:53Z2012-12-17T15:28:53ZExternal SWF Module in Flex Module Loader and PopupManager<div><p>You could set the SystemManager as the contextView, in your main
context, like this:</p>
<pre>
<code>public class ApplicationContext extends ModuleContext
{
public function ApplicationContext(contextView:DisplayObjectContainer = null, autoStartup:Boolean = true)
{
super(contextView.parent, autoStartup);//parent =>>SystemManager
}
override public function startup():void
{
viewMap.mapType(IModule);
}</code>
</pre>
<p>And then there, where you load the module:<br>
PopUpManager.addPopUp(moduleLoader ,
FlexGlobals.topLevelApplication as DisplayObject);<br>
where moduleLoader is a ModuleLoader ;)</p></div>Ondina D.F.tag:robotlegs.tenderapp.com,2009-10-18:Comment/227674482012-12-17T19:35:01Z2012-12-17T19:35:01ZExternal SWF Module in Flex Module Loader and PopupManager<div><p>Stil not working , I have now main context declared as</p>
<pre>
<code><fx:Declarations>
<local:ShellContext contextView="{DisplayObjectContainer(FlexGlobals.topLevelApplication)}"/>
<flex:ModuleProgressLoader id="module_fileLoad" width="600" height="550" url="FileLoadModule.swf" />
</fx:Declarations></code>
</pre>
<p>and adding popup in ShellMediator as:</p>
<pre>
<code>PopUpManager.addPopUp(shell.module_fileLoad,FlexGlobals.topLevelApplication as DisplayObject,true);
PopUpManager.centerPopUp(shell.module_fileLoad);</code>
</pre>
<p>but its still not working,, other two external modules (on Shell
View Displaylist) are working fine.</p></div>thexebtag:robotlegs.tenderapp.com,2009-10-18:Comment/227674482012-12-18T06:11:11Z2012-12-18T06:11:11ZExternal SWF Module in Flex Module Loader and PopupManager<div><p>what is that i m missing , :(</p></div>thexebtag:robotlegs.tenderapp.com,2009-10-18:Comment/227674482012-12-18T11:38:52Z2012-12-18T11:38:52ZExternal SWF Module in Flex Module Loader and PopupManager<div><blockquote>
<p>local:ShellContext
contextView="{DisplayObjectContainer(FlexGlobals.topLevelApplication)}"</p>
</blockquote>
<p>You don’t have access to the system manager in your
example.<br>
3 possible solutions:</p>
<ul>
<li>[1] If you use the declaration tag, set the contextView like
this:</li>
</ul>
<pre>
<code><common:ApplicationContext contextView="{SystemManager.getSWFRoot(this) as DisplayObjectContainer}"/></code>
</pre>
<p>Or like so:</p>
<pre>
<code><common:ApplicationContext contextView="{parentContainer}"/></code>
</pre>
<p>Where parentContainer is:</p>
<pre>
<code>[Bindable]
private var parentContainer:DisplayObjectContainer;</code>
</pre>
<p>and set inside the preinitialize handler:</p>
<pre>
<code>private function preinitializeHandler(event:FlexEvent):void
{
parentContainer=this.parent;
}</code>
</pre>
<p>And in your context just as usual:<br>
super(contextView , true);</p>
<ul>
<li>[2] I’d prefer to initialize the context in actionscript
within the preinitialize handler for the FlexEvent.PREINITIALIZE,
fired by the application:</li>
</ul>
<pre>
<code>private var context:ApplicationContext;
private function preinitializeHandler(event:FlexEvent):void
{
context = new ApplicationContext(this.parent);
}</code>
</pre>
<p>and in the context:</p>
<p>super(contextView, true);</p>
<p>Or as in my previous post:</p>
<pre>
<code>private function preinitializeHandler(event:FlexEvent):void
{
context = new ApplicationContext(this);
}</code>
</pre>
<p>and in the context:</p>
<p>super(contextView.parent , true);</p>
<ul>
<li>[3] <strong>pass the parent injector on to the module through
its interface</strong></li>
</ul>
<p>You initialize your context as you wish, inside the declaration
tag or in actionscript</p>
<pre>
<code><common:ApplicationContext contextView="{this}"/></code>
</pre>
<p>Or</p>
<pre>
<code>private var context:ApplicationContext;
private function preinitializeHandler(event:FlexEvent):void
{
context = new ApplicationContext(this);
}</code>
</pre>
<p>and then there, where you create the popup, you pass the parent
injector to the module. Of course the class that creates the popup
should have access to the injector (set or Inject )</p>
<pre>
<code>//[Inject]
public var _parentInjector:IInjector;
PopUpManager.addPopUp(moduleLoader, FlexGlobals.topLevelApplication as DisplayObject);
PopUpManager.centerPopUp(moduleLoader);
(moduleLoader.child as IModule).parentInjector=_parentInjector;</code>
</pre>
<p>Does this help?</p></div>Ondina D.F.tag:robotlegs.tenderapp.com,2009-10-18:Comment/227674482012-12-18T11:50:21Z2012-12-18T11:50:21ZExternal SWF Module in Flex Module Loader and PopupManager<div><p>great that works , i just modified main context as</p>
<pre>
<code><common:ApplicationContext contextView="{SystemManager.getSWFRoot(this) as DisplayObjectContainer}"/></code>
</pre>
<p>and evrything else remain same , its working ,<br>
thanks alot <strong>odina</strong> :)</p></div>thexebtag:robotlegs.tenderapp.com,2009-10-18:Comment/227674482012-12-18T12:24:59Z2012-12-18T12:24:59ZExternal SWF Module in Flex Module Loader and PopupManager<div><p>That’s good news :) You’re welcome!</p>
<p>Ondina</p></div>Ondina D.F.tag:robotlegs.tenderapp.com,2009-10-18:Comment/227674482012-12-19T17:05:45Z2012-12-19T17:07:16ZExternal SWF Module in Flex Module Loader and PopupManager<div><p>hi Odina , one thing happened ,<br>
I was debuging my app on a local server (wamp) with the default
flex html wrapper, every thing working fine , then i uploaded to my
remote server . I have wordpress install on remote server so i am
using a plugin Kimili Flash Embed , for wraping swf. Now the loaded
Module again not working,no mediation , with same build on local
server working fine , does wrapper matters?what can be the
issue?</p></div>thexebtag:robotlegs.tenderapp.com,2009-10-18:Comment/227674482012-12-19T18:18:17Z2012-12-19T18:18:17ZExternal SWF Module in Flex Module Loader and PopupManager<div><p>Hi thexeb,</p>
<p>I have no idea what Kimili Flash Embed does. I went to their
site, and there is a FAQ section: <a href=
"http://kimili.com/plugins/kml_flashembed#faqs">http://kimili.com/plugins/kml_flashembed#faqs</a>
Maybe you can find an answer there :)</p>
<p>Could it be that you’re not having access to the IModule
interface anymore because of that wrapper? Is the wrapper
necessary? Can you at least try running the app on the server
without the wrapper, to see what happens then?</p>
<p>The ApplicationDomain can’t be the problem, since
we’ve already discussed that in another thread, right?</p>
<p>Ondina</p></div>Ondina D.F.tag:robotlegs.tenderapp.com,2009-10-18:Comment/227674482012-12-19T18:33:14Z2012-12-19T18:33:14ZExternal SWF Module in Flex Module Loader and PopupManager<div><p>i have wordpress installled on my site ,this plugin suits well
with it, i have already running app built with RL Modular .<br>
<a href=
"http://thexaib.com/cat_mini_apps/photo-spark-studio/">http://thexaib.com/cat_mini_apps/photo-spark-studio/</a></p>
<p>this was pure AS3.0 app ,with two external modules,<br>
i am currently upgrading GUI of it, ie building in FLEX,<br>
the same wrapper should work ? but its not working, i don't know
its about wrapper or something else. i have tried to open swf in my
browser (without the wrapper) , still not working.<br>
<a href=
"http://thexaib.com/apps/xps/ShellModule.swf">http://thexaib.com/apps/xps/ShellModule.swf</a><br>
when Open File Button is clicked , an other external module is
loaded.,but its not working, not mediated ,otherwise the close
button would work.</p></div>thexebtag:robotlegs.tenderapp.com,2009-10-18:Comment/227674482012-12-19T18:38:25Z2012-12-19T18:42:08ZExternal SWF Module in Flex Module Loader and PopupManager<div><p>Kimili Flash Embed provide swfObject like wrapper in wordpress,
its simple i think :( as my pure AS3.0 is working fine with it</p></div>thexebtag:robotlegs.tenderapp.com,2009-10-18:Comment/227674482012-12-19T18:40:41Z2012-12-19T18:40:41ZExternal SWF Module in Flex Module Loader and PopupManager<div><p>I’m sorry, but we’ll have to continue our discussion
tomorrow. I’m about to go out for dinner.</p></div>Ondina D.F.tag:robotlegs.tenderapp.com,2009-10-18:Comment/227674482012-12-19T18:44:21Z2012-12-19T18:44:21ZExternal SWF Module in Flex Module Loader and PopupManager<div><p>no problem ,thanks for your time , :)</p></div>thexebtag:robotlegs.tenderapp.com,2009-10-18:Comment/227674482012-12-20T06:48:49Z2012-12-20T06:48:49ZExternal SWF Module in Flex Module Loader and PopupManager<div><p>Now i uploaded Debug files,(Not Release Build) and its working,
weird</p></div>thexebtag:robotlegs.tenderapp.com,2009-10-18:Comment/227674482012-12-20T07:53:57Z2012-12-20T07:53:57ZExternal SWF Module in Flex Module Loader and PopupManager<div><p>Good morning :)</p>
<blockquote>
<p>Now i uploaded Debug files,(Not Release Build) and its working,
weird</p>
</blockquote>
<p>It sounds like the metadata has been stripped out. Take a look
at this:</p>
<p><a href=
"https://github.com/robotlegs/robotlegs-framework/wiki/Common-Problems#wiki-metadata-stripping">
https://github.com/robotlegs/robotlegs-framework/wiki/Common-Proble...</a></p>
<p>If you’re using FlashBuilder, add these compiler
arguments:</p>
<p>-keep-as3-metadata+=Inject</p>
<p>-keep-as3-metadata+=PostConstruct</p></div>Ondina D.F.tag:robotlegs.tenderapp.com,2009-10-18:Comment/227674482012-12-20T08:42:15Z2012-12-20T08:42:15ZExternal SWF Module in Flex Module Loader and PopupManager<div><p>In the title of this discussion you mentioned that the module
was external. Does that mean you compiled it in another application
and then added it to the current application?<br>
If the answer is yes, then, if you’re using FlashBuilder, add
the compiler arguments (keep metadata…) mentioned previously
to the application that is creating the module, and when you create
the module, choose “do not optimize (module can be loaded by
multiple applications)” under Properties-Flex Modules</p>
<p>In the application loading the external module choose library
linkage: “runtime shared library (RSL), under Properties-Flex
Build Path and also add the compiler arguments for metadata.</p>
<p>Try it out and tell me how it goes.</p></div>Ondina D.F.tag:robotlegs.tenderapp.com,2009-10-18:Comment/227674482012-12-20T10:13:06Z2012-12-20T10:13:06ZExternal SWF Module in Flex Module Loader and PopupManager<div><p>No same FlashBuilder is compiling multiple modules,it worked
when i choose Donot Optimize . :)<br>
thanks Odina , u being very helpfull and kind</p></div>thexeb