Hi zxcvb,

You can solve the problem of closing the popUp existing in module by
doing the following stuff.

Step 1.
Make an interface that extends IFlexDisplayObject. Code below --

import mx.core.IFlexDisplayObject;
public interface IPopUp extends IFlexDisplayObject
{
        function closeWindow():void;
}

Step 2.
Make the popup component (titlewindow in your case) implements this
interface.
And also implement the function you have in the interface --
public function closeWindow():void
{
        PopUpManager.removePopUp(this);
}

Step 3.
When you unload the module, call this function.

You can do that in this manner ----

private function closeAllWindows():void {
        var popup:IPopUp;
        var popupCollection:Array;
        for (var i:Number=0;i<systemManager.popUpChildren.numChildren;i++)
        {
                popupCollection = getQualifiedClassName
(systemManager.popUpChildren.getChildAt(i)).split("::");
                if (popupCollection[0] == "comp")
                {
                        popup = systemManager.popUpChildren.getChildAt(i) as 
IPopUp;
                        popup.closeWindow();
                }
        }
}

In this way you can clean up all the pop-up windows that are hovering
in your application. Try and play with the above code. You will be
able to close the window.

About your dispatching an event to a module from an application I
guess is not a big deal, dispatch an event from the application, and
if there is a listener in the module, it will listen for it and
perform the functionality when the event is dispatched.

Let me know if this helps.

Take Care.
Thanks.

On Oct 6, 10:12 am, zxcvb <[email protected]> wrote:
> I found this but it doesn't seem to work for 
> me:http://yakovfain.javadevelopersjournal.com/flex_best_practices_sketch...
>
> I urgently need to come up with a solution to pass an event to a
> module from an application.
>
> The modules pop up titlewindows which close when the user clicks
> somewhere in the module.
>
> Unfortunately, I just found out that the titlewindow doesn't close
> when the module is unloaded.
>
> I think I need to send an event to the module to close it. But that
> isn't working:
>
> mdLoader.child.dispatchEvent(new CloseEvent(CloseEvent.CLOSE, true));
>
> Please help. It's very urgent.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Flex 
India Community" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/flex_india?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to