3 Replies Latest reply on Mar 21, 2010 8:21 PM by saisri2k2

    How to get Panel coordinates

    Raghuvasa Level 1

      Hi All,

       

       

                  i have a panel in canvas layout.

       

                 if want to add one more panel immediate  next to the first panel i need to know  x, y coordinate of the first panel.

       

                  How can i know i the coordinates.

       

      Can any help me?

       

      thanks

      Raghu

        • 1. Re: How to get Panel coordinates
          Francisc Level 3

          You can get the coordinates by:

           

          panelOne.x and panelOne.y

           

          panelOne is the id of your panel. e.g. <mx:Panel id="panelOne" ...>...</Panel>

           

           

          To add a new panel right next to it you have to set the x and y for the new panel like this:

           

          newPanel.x=panelOne.x+panelOne.width;

          newPanel.y=panelOne.y+panelOne.height;

           

          Hope this helps.

          • 2. Re: How to get Panel coordinates
            jsd99 Level 3

            If this is something you're going to be doing a lot of, you might want to just stick the panel in an HBox and use hbox.addChild() to add the next panel.  Plus if you get in the situation where you've added 3 panels and you need to remove the second one, this way will save you from having to move everything around yourself.

            • 3. Re: How to get Panel coordinates
              saisri2k2 Level 4

              if you want to add the panels ina flow layout there is a flowContainer component available .. google it.. it will automatically places the components into the next line if it is too much for the current line.