3 Replies Latest reply on Feb 11, 2007 8:03 AM by newman_

    popup and add copied object

    newman_ Level 1
      Hi!
      I created popup using addPopUp(). My question is how to copy object (like for example DataGrid or ComboBox) from main app to popup??? I found only addChild but when I'm using this then my object appear in popup and disappear in main app!
      Is it possible to make copy of object and put it in popup?
        • 1. Re: popup and add copied object
          darko.romanov Level 1
          Hi, maybe you could create a new datagrid, or combo, that share the same dataProvider of the main app.
          • 2. Re: popup and add copied object
            RyoZero Level 1
            There are many ways to create a PopUp, the better for my mind with this steps.

            1.- you create your main window.
            <mx:Application>
            </mx:Application>

            2.you need create a custome component (MXML COMPONENT).
            like this.
            <?xml version="1.0" encoding="utf-8"?>
            <mx:TitleWindow xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute" width="594" height="488" creationComplete="Init();">

            </mx:TitleWindow>


            3.- In your TitleWindow need add a var to keep your object( DataGrid, ComboBox, Label, etc)
            <?xml version="1.0" encoding="utf-8"?>
            <mx:TitleWindow xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute" width="594" height="488" creationComplete="Init();">

            public var _DataGrid:DataGrid;

            </mx:TitleWindow>

            4.- When you create a popup make sure to send the object; like this...
            <mx:Application>

            private function ShowPopup(): void {
            var _titleWindow:TitleWindow=TitleWindow(PopUpManager.createPopUp(this, TitleWindow, true));
            _titleWindow._DataGrid = this.DataGrid //this is my datagrid on my main forma or application form.
            }
            </mx:Application>
            • 3. Re: popup and add copied object
              newman_ Level 1
              Big thanks!
              Now it's clear! I'll test both tips :)