views:

34

answers:

2

I have a component that changes its location based on other elements. I'm trying to find its x and y position at different intervals, so I tried compname.x and compname.y.

The x position seems to be working, but the y position is always 0. I'm guessing I need to play with localToGlobal or contentToGlobal or one of those conversions. Is that the problem?

+2  A: 

A component's x and y values are relative to it's parent. Flex calls this the content coordinate system; and the contentToGlobal should give you the answers you need.

Read up on positioning components, which explains the content, local, and viewable coordinates:

http://livedocs.adobe.com/flex/3/html/help.html?content=size_position_2.html

And read up on the Flex coordinate system:

http://livedocs.adobe.com/flex/3/html/help.html?content=containers_intro_5.html#254752

If you had a working example it may be easier to give a specific answer.

www.Flextras.com
Great hint. Looks like it's working now. Thank you.
Kamo
+1  A: 

...also, have a look at getBounds() - this method returns you the position relative to other display objects.

simon

Simon Gladman