main.mxml

<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";

layout="vertical">

<mx:Script>

<![CDATA[

*import* mx.controls.Alert;

*import* mx.managers.PopUpManager;

*private* *function* openPopUp():*void*{

*var* _pop:PopUpComp = *new* PopUpComp();

_pop.width = 500;

_pop.height = 300;

_pop.addEventListener(*"backEvent"*, handleBackEvent)

PopUpManager.addPopUp(_pop,*this*,*true*);

PopUpManager.centerPopUp(_pop);

}

 *private* *function* handleBackEvent(event:Event):*void*{

Alert.show(*"Message from Parent Application"*);

}

]]>

</mx:Script>

 <mx:Button label="Open PopUp" click="openPopUp()" />

</mx:Application>


PopUpComp.mxml



<?xml version="1.0" encoding="utf-8"?>

<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml";

showCloseButton="true"

close="{PopUpManager.removePopUp(*this*)}">

<mx:Metadata>

[*Event*(name=*"backEvent"*)]

</mx:Metadata>

<mx:Script>

<![CDATA[

*import* mx.managers.PopUpManager;

*private* *function* handleClick():*void*{

PopUpManager.removePopUp(*this*);

dispatchEvent( *new* Event(*"backEvent"*));

}

]]>

</mx:Script>

 <mx:TextArea width="400" height="200" />

<mx:Button click="handleClick()" label="OK" />

</mx:TitleWindow>











On Thu, Jul 29, 2010 at 6:09 PM, Mohamed Salah Guetat <
[email protected]> wrote:

> can you please write an exmaple
> thx
>
> 2010/7/29 Khalid Chaudhary <[email protected]>
>
>>   dispatch event from popup.mxml and catch it in main.mxml
>>
>>
>>   On Thu, Jul 29, 2010 at 5:44 PM, Salah <[email protected]>wrote:
>>
>>>  can i share event between mxml ?
>>>
>>> for example i have 2 file : main.mxml and popup.mxml
>>>
>>> by pressing  button on popup.mxml  the main.mxml must show alert
>>> how can i do this !!
>>>
>>> --
>>> 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]<flex_india%[email protected]>
>>> .
>>> For more options, visit this group at
>>> http://groups.google.com/group/flex_india?hl=en.
>>>
>>>
>> --
>> 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]<flex_india%[email protected]>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/flex_india?hl=en.
>>
>
> --
>  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]<flex_india%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/flex_india?hl=en.
>

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