2 Replies Latest reply on Apr 3, 2008 6:43 AM by jjjake01

    Can't open popup window in item renderer

    Pigg_Man
      I have a datagrid with two columns. Each column has it's own itemRenderer. The itemRenderers have there own class. In one itemrenderer I have a link button and it has a click event that is associated with it in the script block of that class. Inside the click event I have the following code to create a popup:
      var popup_win:MyWindowType = MyWindowType (PopUpManager.createPopUp (this, MyWindowType , true));

      When I click the linbutton I will see a flash and a blur affect as if the window is trying to open but never does. I've traced "this" and it's the renderer... So I tryed to reference back up the that class that has the datagrid control... which is this.parent.parent.parent... but that doesn't work either. I'm basically trying to open a window that allows the user to choose some stuff from a radio button and then when they click ok on the popup window it does some validation and then the contents get's changed in the cell that it came from. I want the popup to open upon clicking of the link button or else I would use the editor functionality. Any ideas of how I could do this?
        • 1. Re: Can't open popup window in item renderer
          Pigg_Man Level 1
          I did this and it works

          var popup_win:MyType = MyType(PopUpManager.createPopUp(DisplayObject(this.parentApplication), MyType , true));

          Thanks me
          • 2. Re: Can't open popup window in item renderer
            jjjake01
            Good Day

            I had the same idea for an itemrenderer....but I'm using the mouse_over event.

            A titlewindow pops up when moving over a row in the datagrid, and closes when moving out.

            The intent of the popup is to show some charts and additional links.

            However, when the popup shows, and I move my mouse into the popup box, the mouse movements are still being registered by the datagrid row below the popup box...hence making a new popup box appear every time I move the mouse.

            I tried to set focus on the popup alone...but still doesn't work.
            Here's the itemrenderer code:

            <mx:Text xmlns:mx=" http://www.adobe.com/2006/mxml" creationComplete="_OnCC()" mouseOut="_mOut()">
            <mx:Script>
            <![CDATA[
            import mx.core.Application;
            import flash.events.MouseEvent;
            import mx.managers.PopUpManager;
            //import mx.controls.Alert;


            private var pop1:_popup_gridb;

            public var currentColumn:String = "";

            public function _OnCC():void{
            var currentXml:XML = new XML(data..field.(@columnname==currentColumn));
            text = currentXml.@value;
            text = text.toUpperCase();

            addEventListener(MouseEvent.MOUSE_OVER, _mOver);
            //addEventListener(MouseEvent.MOUSE_OUT, _mOut);

            }

            private function _mOver(event:MouseEvent):void{
            //Alert.show("Hello World");

            pop1 = _popup_gridb(
            PopUpManager.createPopUp(DisplayObject(this.parentApplication),_popup_gridb,false));

            //PopUpManager.createPopUp(Application.application as Sprite,_popup_gridb,false));
            //PopUpManager.createPopUp(this,_popup_gridb,false));

            pop1.showCloseButton=true;
            pop1.id = "_pu" + Math.random();
            //pop1.dataView = dv;
            pop1.title = pop1.id.toString();
            PopUpManager.centerPopUp(pop1);
            //removeEventListener(MouseEvent.ROLL_OVER,_mOver);


            }

            private function _mOut():void{
            PopUpManager.removePopUp(pop1);
            //addEventListener(MouseEvent.ROLL_OVER, _mOver);

            }


            ]]>
            </mx:Script>

            </mx:Text>


            Currently, the popup is just a titlewindow w/a datagrid inside.

            thx
            j