2 Replies Latest reply on Jul 31, 2006 1:13 AM by Antoni_H.

    Trouble with passing data to Popup

    Antoni_H.
      Hello,

      after solving my problems, I am getting step by step further. But now I got a problem, which I really dont know how to solve. I tried the example from the docs, but no - nothing helped me. May be you can...

      So does somebody know how to pass data to a created popup? eg - I want to pass the element ID which called the popup to create, how can I make that?

      Please , it's almost weekend and I don't want to bother me with that, pleeeeeeaaase help me.

      cya.
        • 1. Re: Trouble with passing data to Popup
          ntsiii Level 3
          I haven done this i 2.0, but ...
          Define a public variable in the popup component.

          call createPopup, assigning the result to a variable. then use that variable to access the public varialbe in the component.

          If I get a chance I will try to create an example.

          Tracy
          • 2. Re: Trouble with passing data to Popup
            Antoni_H. Level 1
            Hello,

            so I tried what you wrote, but without success. Maybe I am doing somehting wrong, thats why i post the code now.



            Code from parent component:

            quote:


            public function popupHandler(menu:Object):void {

            function clear():void {
            popUpWindow.visible = false;
            }

            PopUpManager.removePopUp(popUpWindow);

            popUpWindow = new components.popupPanel();
            popUpWindow.height = 545;
            popUpWindow.width = 0;
            popUpWindow.x = this.x;
            popUpWindow.y = this.y +40;

            //var myPopup = PopUpManager.createPopUp(this, popUpWindow, false);
            var myPopup = mx.managers.PopUpManager.addPopUp(popUpWindow, this, false );
            var dataToPass:String = new String();

            if (menu.id == 'button1'){
            dataToPass = "Button 1 pressed";
            }
            else dataToPass = "Nothing pressed!";

            myPopup.myData = dataToPass;


            }


            Code from popup component

            quote:


            <?xml version="1.0" encoding="utf-8"?>
            <mx:Canvas initialize="showPopup.play()" xmlns:mx=" http://www.adobe.com/2006/mxml" width="100%" height="100%" borderStyle="solid" cornerRadius="10" borderThickness="0" backgroundAlpha="1.0" backgroundImage="@Embed('../Images/popupPanelBack.png')" borderColor="#ffffff" dropShadowEnabled="true">

            <mx:Parallel id="showPopup" target="{this}" duration="800">
            <mx:Move xBy="-250" easingFunction="Quintic.easeOut" />
            <mx:Resize widthBy="250" easingFunction="Quintic.easeOut" />
            </mx:Parallel>

            <mx:Label x="10" y="10" text="Description" fontWeight="bold" id="popupPanelLabel" color="#ffffff"/>
            <mx:Text x="10" y="36" text="{myData}" id="popupPanelText" color="#ffffff"/>
            <mx:Script>
            <![CDATA[

            import mx.managers.PopUpManagerChildList;
            import mx.managers.PopUpManager;
            import mx.core.UIComponent;
            import mx.managers.SystemManager;
            import mx.effects.easing.*;
            import mx.controls.Text;
            [Bindable]
            public var myData:String;
            ]]>
            </mx:Script>
            </mx:Canvas>



            I dont know how to make it work. so please take a look... thx.

            Antoni