If you want to determine the global coordinates of the upper-left corner
of a component, you do
myComponent.localToGlobal(new Point(0, 0));
not
myComponent.localToGlobal(new Point(myComponent.x, myComponent.y));
The upper-left corner of a component in its own coordinate system is (0,
0).
Its x and y coordinates give its upper-left corner in its parent's
coordinate system.
Gordon Smith
Adobe Flex SDK Team
________________________________
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Corey Smaller
Sent: Wednesday, January 16, 2008 2:58 PM
To: [email protected]
Subject: [flexcoders] Re: localToGlobal X position
I lied, the X and Y position is returning god knows what, all i know
is its wrong.
//compare the next highlighted component with the button found in arr
if(buttonArray[arr] == focusManager.getNextFocusManagerComponent())
{
//start to convert to global X and Y
var pt:Point= new Point(buttonArray[arr].x,buttonArray[arr].y);
var maskPoint:Point = new Point(testCanvas.x,testCanvas.y);
maskPoint = testCanvas.localToGlobal(maskPoint);
trace("local mask" + maskPoint);
pt = buttonArray[arr].contentToLocal(pt);
trace("content tolocal for "+ buttonArray[arr].label +
"="+ pt);
}
weird
>