Listen to updateComplete perhaps? If that doesn't work, I'm not sure what will.
-Josh On Feb 8, 2008 3:04 PM, derelkington <[EMAIL PROTECTED]> wrote: > Thanks for the help. I had tried localToGlobal, but I guess only on the > parent containers > but not on the button itself. > > This had led to a new problem, however... the resulting coordinates are > not correct if I try > and find them any time during the creation/initialization process. Even if > finding the > coordinates is the absolute last thing I do after creating all the > components, adding them > all as children, etc., the resulting coordinates do not correctly > correspond to the actual > button positions. Is there any way to fix this so I can find the > coordinates as part of the > initialization process? > > Thanks! > > > --- In [email protected] <flexcoders%40yahoogroups.com>, > "luvfotography" <[EMAIL PROTECTED]> wrote: > > > > Hi, try looking at the localToGlobal method: > > Converts a Point object from the local coordinate system to the > > global coordinate system. > > > > > > > > --- In [email protected] <flexcoders%40yahoogroups.com>, > "derelkington" > > <derek.shockey+y@> wrote: > > > > > > Hi everyone, I'm having trouble trying to find the x,y-coordinate > > position of components > > > within my application. I'm a brand new Flex developer with > > experience in Java, C, Python, > > > PHP, ColdFusion, etc. but no experience with Flash or ActionScript. > > > > > > In short, my question is: is there an easy way to find the location > > of a component within > > > the window? I have a number of buttons added programatically whose > > .x and .y properties > > > are all just 0. It seems like this should be a simple task, but I > > have tried for hours and > > > failed. > > > > > > The situation in detail is this: > > > In my MXML, I have defined a Grid inside of my Application. The Grid > > is placed with > > > horizontalCenter=0 and paddingTop=50. Inside of the grid is a > > GridRow containing an > > > empty GridItem. Upon creationComplete of the Application, a function > > is called which > > > instantiates a subclass of Tile, and adds it to the empty GridItem > > with addChild. In > > > addition, the Tile subclass has a constructor which creates and > > places a number of > > > buttons inside the Tile. (There are also other rows and items in the > > Grid containing some > > > other components.) > > > > > > So in essence the structure is: Application -> Grid -> GridRow -> > > GridItem -> Tile -> > > > Buttons. > > > > > > This all looks just the way I want it to and functions fine, except > > I am unable to find the > > > location coordinates of the Buttons. All of the buttons as well as > > the Tile itself have x and y > > > as 0. I have tried using the localToGlobal to convert, but this > > doesn't work since the > > > buttons don't even have an x,y relative to the parent, they simply > > have an x,y of 0. > > > > > > I feel like someone may want to know why I need the position of the > > button. The specific > > > answer is that I want to place a series of additional labels on top > > of it, but the general > > > answer is that it just seems like something a developer should be > > able to do when working > > > with a GUI. > > > > > > Any help would be greatly appreciated! Thanks. > > > > > > > > -- "Good people will do good things, and bad people will do bad things. But for good people to do bad things—that takes religion." :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED]

