Guys,

Once again, if you are in love with the events and dont want to live
without. And the things are not working fine in usual way.

Just move out a bit, make one singleton class in your main module and
exploit it, dispatch an event on Singleton's object, you can listen that
event on that single object wherever you want throughout the scope of the
application,i.e. between inter module communication.

But dont forget to play safe with events and specially when you are
dispatching it at the singleton level. Remove it after listening to it and
make proper use of useWeakRefrence, else it will shoot the memory
consumption and may result in very weird bugs.



On Wed, Oct 7, 2009 at 1:03 AM, gaurav rai <[email protected]> wrote:

> Hi Folks,
> This example might help you..... Please find it in attachment.
> Thanks;
>
> On Tue, Oct 6, 2009 at 11:07 PM, vicky <[email protected]> wrote:
>
>>
>> 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.
>>
>>
>>
>
> >
>


-- 
Thanks,
Vaibhav Seth.

--~--~---------~--~----~------------~-------~--~----~
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