Here is the modified code yours

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

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

                               width="248" height="204"

                               title="window pop-up"

                               showCloseButton="true"

                               close="closePopUp()" >

       <mx:Script>

               <![CDATA[

                       *import* mx.managers.PopUpManager

                       [*Bindable*] *public* *var* str:String = *""*;

                               *public* *var* myData:String=*""*;

                               *public* *function* closePopUp():*void*

                               {



                                       PopUpManager.removePopUp(*this*);

                               }



                               *private* *function* onOk(ev:MouseEvent):*
void*{

                                           str = txt_message.text;

                                           *this*.dispatchEvent(*new* Event(
*"onOkEvent"*,*true*));

                               }

               ]]>

       </mx:Script>

       <mx:TextInput id="txt_message" />

       <mx:Button label="Ok" id="btn_ok" click="onOk(event)"/>

</mx:TitleWindow>




---------------------


main app file:


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

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

      <mx:Script>

            <![CDATA[

                  *import* mx.events.CloseEvent;

                  *import* mx.managers.PopUpManager;

              [*Bindable*] *var* mainApp:String;

              *var* p:pop

                  *function* showPopUp():*void*{

                              p = *new* pop();

                        PopUpManager.addPopUp(p,*this*);

                        p.addEventListener(*"onOkEvent"*,onOK);



                  }



                  *function* onOK(ev:Event):*void*{

                         mainApp = p.str;

                         btn.label = mainApp;

                  }

            ]]>

      </mx:Script>

      <mx:Button id="btn" label="create" click="showPopUp()" />

</mx:Application>





On Thu, Jul 29, 2010 at 7:53 PM, Sidhu Vijay Sidhu <[email protected]>wrote:

> 1. create the object of one mxml into another..and use it
> 2. Or dispatch the event from one mxml with data and handle it in another
> mxml
>
> On Thu, Jul 29, 2010 at 8:02 AM, Salah <[email protected]> wrote:
>
>> hi,
>> i'm new in Flex and i need your help !!
>>
>> i need to share variable between a main.mxml and a popup.mxml
>> for example :
>>
>>
>> 1-popup.mxml
>>
>> <?xml version="1.0" encoding="utf-8"?>
>> <mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml";
>>                                width="248" height="204"
>>                                title="window pop-up"
>>                                showCloseButton="true"
>>                                close="closePopUp()" >
>>        <mx:Script>
>>                <![CDATA[
>>                        import mx.managers.PopUpManager
>>                                public var myData:String="";
>>                                public function closePopUp():void
>>                                {
>>                                        PopUpManager.removePopUp(this);
>>                                }
>>                ]]>
>>        </mx:Script>
>>        <mx:TextInput id="txt_message" />
>>        <mx:Button label="Ok" id="btn_ok"/>
>> </mx:TitleWindow>
>>
>>
>> 2- main.xml
>> ....
>> ...
>> <mx:TextInput id="txt"/>
>>
>>
>> on clicking button OK in the popup window , the text on  "txt_message"
>> should appear on "txt"
>> i must do it without parentApllication !!
>>
>> please help
>>
>> --
>> 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