To answer your question Ben: Yes you can inject beans defined in the
root application into popups spawned by modules. You can also inject
beans defined in the module into popups spawned by the module using
something like Brian's SwizAware class but if that popup is complex,
the child components do not have access to the beans. If you try to
create a popup that loads a module the module has access to the beans
defined in the module but not beans defined in the main app.
As a side note, I took my own advice and started working on a Popup
manager replacement. I created a Group component that is defined in
the bean config and added it to the top level application. Then I can
call that bean to add and remove popups. It's not as nice as the Popup
manager (considering I only worked on it a few hours) but it does
resolve the display list issue that the standard PopupManager
presents. Below is the code I've come up with so far:
The Popup canvas:
<?xml version="1.0" encoding="utf-8"?>
<s:Group xmlns:fx="
http://ns.adobe.com/mxml/2009"
xmlns:s="library://
ns.adobe.com/flex/spark"
xmlns:mx="library://
ns.adobe.com/flex/mx" width="100%"
height="100%">
<fx:Declarations>
</fx:Declarations>
<s:states>
<s:State name="normal"/>
<s:State name="modal"/>
</s:states>
<fx:Script>
<![CDATA[
import mx.containers.TitleWindow;
import mx.core.IVisualElement;
public function addPopup(window:IVisualElement,
modal:Boolean):void{
this.addElement(window);
this.currentState = modal?"modal":"normal";
}
public function centerPopup(window:IVisualElement):void{
window.x = (this.width/2)-(window.width/2);
window.y = (this.height/2)-(window.height/2);
}
public function removePopup(window:IVisualElement):void{
}
]]>
</fx:Script>
<s:Rect top="0" bottom="0" left="0" right="0" includeIn="modal">
<s:fill>
<s:SolidColor color="0xffffff" alpha="0.5" />
</s:fill>
</s:Rect>
</s:Group>
Injecting it into the main app:
[Inject]
public var swizPopupCanvas:SwizPopupCanvas;
[PostConstruct]
public function addPopupCanvas():void{
this.addElement(swizPopupCanvas);
}
calling it from another part of the app:
swizPopupCanvas.addPopup(testModal,true);
swizPopupCanvas.centerPopup(testModal);
As you can see I still need to work out removing the popup and making
the popup draggable but I'm hopeful that this will be a good
workaround.
> On Thu, Sep 16, 2010 at 1:47 AM,
ben.clinkinbe...@gmail.com <
>
>
ben.clinkinbe...@gmail.com> wrote:
> > Just so I am clear, the problem you are having is you want to inject a bean
> > that is defined within a child Swiz instance into a pop up or a descendant
> > of a pop up, correct?
>
> > The original title of this thread implies that [Dispatcher] is not being
> > injected at all, which should never be the case. The way things stand right
> > now, the only injections available to pop ups and their descendants are
> > beans defined within the root Swiz instance. I wouldn't expect this to be a
> > huge or common issue, because it can be solved either by manually supplying
> > dependencies or by defining the necessary beans in the root Swiz instance.
>
> > If anyone has a compelling argument about why neither of those solutions is
> > adequate, please provide it so we can discuss/evaluate potential solutions.
>
> > Thanks,
> > Ben
>
> > On Wed, Sep 15, 2010 at 6:20 PM, Michael Harper <
ctd...@gmail.com> wrote:
>
> >> Aha I see.
>
> >> On Wed, Sep 15, 2010 at 10:08 PM, Brian Kotek <
brian...@gmail.com> wrote:
>
> >>> They've solved it by making you do it manually, which is exactly what
> >>> we're trying to avoid. But like I said, there may not be another way,
> >>> unfortunately.
>
> >>> Brian
>
> >>> On Wed, Sep 15, 2010 at 4:12 PM, Michael Harper <
ctd...@gmail.com>wrote:
>
> >>>> Hi Brian,
>
> >>>> Yes your correct modules work great actually it's just the popups as you
> >>>> say. However, I'm led to believe that Parsley has this solved which begs a
> >>>> question. I'll find out if they have an report back.
>
> >>>> Mike
>
> >>>> --
> >>> You received this message because you are subscribed to the Google Groups
> >>> "Swiz Framework" group.
> >>> To post to this group, send email to
swiz-fr...@googlegroups.com.
> >>> To unsubscribe from this group, send email to
> >>>
swiz-framewor...@googlegroups.com<
swiz-framework%2Bunsu...@googlegroups.com>
> >>> .
> >>
swiz-framewor...@googlegroups.com<
swiz-framework%2Bunsu...@googlegroups.com>
> >> .
> >
swiz-framewor...@googlegroups.com<
swiz-framework%2Bunsu...@googlegroups.com>
> > .