Popup support with Module
In Mediators not being created for subviews when createMediator() is called on parent view being added as a popup, I was asking about making robot legs work with popups and I was showed to attach the context to the SystemManager instead of the context. This worked great for my applications.
Now I trying to roboticize legacy code that written as a module
instead of an application. I started by emulating my previous
project:
<fx:Declarations>
<my:Context id="myContext"/>
</fx:Declarations>
// called from onCreationComplete()
private function initContext():void
{
var contextView:DisplayObjectContainer = systemManager.topLevelSystemManager as DisplayObjectContainer;
myContext.contextView = contextView;
}
which is attaching the context to the systemManager (to work with
popups)
However, and I started seeing the following errors:
commandMap [object CommandMap]
ReferenceError: Error #1065: Variable ICommandMap is not defined.
at flash.system::ApplicationDomain/getDefinition()
at org.swiftsuspenders.injectionpoints::PropertyInjectionPoint/applyInjection()[/Development/Projects/SwiftSuspenders/src/org/swiftsuspenders/injectionpoints/PropertyInjectionPoint.as:35]
at org.swiftsuspenders::Injector/injectInto()[/Development/Projects/SwiftSuspenders/src/org/swiftsuspenders/Injector.as:125]
at org.swiftsuspenders::Injector/instantiate()[/Development/Projects/SwiftSuspenders/src/org/swiftsuspenders/Injector.as:139]
at org.robotlegs.base::CommandMap/execute()[/Development/Projects/Robotlegs/robotlegs-framework/src/org/robotlegs/base/CommandMap.as:172]
at org.robotlegs.base::CommandMap/routeEventToCommand()[/Development/Projects/Robotlegs/robotlegs-framework/src/org/robotlegs/base/CommandMap.as:232]
at Function/<anonymous>()[/Development/Projects/Robotlegs/robotlegs-framework/src/org/robotlegs/base/CommandMap.as:98]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at org.robotlegs.base::ContextBase/dispatchEvent()[/Development/Projects/Robotlegs/robotlegs-framework/src/org/robotlegs/base/ContextBase.as:70]
at org.robotlegs.mvcs::Context/startup()[/Development/Projects/Robotlegs/robotlegs-framework/src/org/robotlegs/mvcs/Context.as:151]
at com.crowncastle.levelMaintenance::LmpContext/startup()[C:\development\flexworkspaces\2013.1\flex\src\module_levelMaintenance\src\com\crowncastle\levelMaintenance\LmpContext.as:28]
at org.robotlegs.mvcs::Context/checkAutoStartup()[/Development/Projects/Robotlegs/robotlegs-framework/src/org/robotlegs/mvcs/Context.as:306]
at org.robotlegs.mvcs::Context/set contextView()[/Development/Projects/Robotlegs/robotlegs-framework/src/org/robotlegs/mvcs/Context.as:185]
at LevelMaintenanceApplet/initContext()[C:\development\flexworkspaces\2013.1\flex\src\module_levelMaintenance\src\LevelMaintenanceApplet.mxml:128]
at LevelMaintenanceApplet/onCreationComplete()[C:\development\flexworkspaces\2013.1\flex\src\module_levelMaintenance\src\LevelMaintenanceApplet.mxml:133]
at LevelMaintenanceApplet/___LevelMaintenanceApplet_AppletBase1_creationComplete()[C:\development\flexworkspaces\2013.1\flex\src\module_levelMaintenance\src\LevelMaintenanceApplet.mxml:8]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.core::UIComponent/dispatchEvent()
at mx.core::UIComponent/set initialized()
at mx.managers::LayoutManager/doPhasedInstantiation()
at mx.managers::LayoutManager/doPhasedInstantiationCallback()
ReferenceError: Error #1065: Variable IInjector is not defined.
... same as above ...
ReferenceError: Error #1065: Variable IMediatorMap is not defined.
... same as above ...
I can make it work (with out popup support) if I change the
context to this:
<fx:Declarations>
<my:Context id="myContext" contextView="{this}" />
</fx:Declarations>
which is attaching the context to the module.
I am trying to add robot legs to the module, not necessarily the application. There is only one module, but re-writing it as an application isn't something I would like to do.
Is there anyway I can have things work with the module and popups?
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 Ondina D.F. on 03 Apr, 2013 02:32 PM
Hey Phillip,
It is possible to load modules inside a popup in rl1, but it’s a much more painful process (especially when it comes to garbage collection) than in rl2.
Too bad, you can’t or don’t want to use rl2 :)
Anyway, try this:
View:
Config:
And tell me if it works for you.
I suppose you’re using the Modular utility, right?
Regarding the errors, it’s hard to tell what they mean. Maybe it has to do with the way you pass the ApplicationDomain to the module.
Can you post the code for your main context, and that of the module, and also the part where you set parentInjector in your module.
If you can, it would be even better to attach the app (as zip), or a simple example that reproduces the issue. It might be easier to find the culprit(s).
Ondina
Support Staff 2 Posted by Ondina D.F. on 03 Apr, 2013 02:57 PM
If you want it in your declaration tag:
But this in conjuction with the modular utility, mappings get overwritten and you get some warnings....
I prefer to instantiate the context through actionscript.
Ondina D.F. closed this discussion on 23 Apr, 2013 03:17 PM.