How can you get the x,y coordinates of a datagrid headerRenderer in Flex?

I am creating a headerRenderer for a datagrid, and the code works as expected, however I need to find the x,y coordinates of the content in the renderer.

I have tried tips/hints online, but nothing works -- it always gives back 0,0 as the coordinates, even when using the function to convert local to global.

Is there some trick to getting the actual x,y coordinates from inside a datagrid header component?  I believe the same problem exists for cells in itemrenderers.



var pt:Point = new Point(this.x,this.y); 
pt = localToGlobal(pt); 
 
pt.x SHOULD be the global X position, but is ALWAYS zero.
pt.y SHOULD be the global Y position, but is ALWAYS zero.

Open in new window

andrewschwabeAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
ngiamourisConnect With a Mentor Commented:
Maybe you're trying to determine the coordinates before the actual component has been laid out. Try hooking on the updateComplete event and see if the coordinates still remain 0,0.
0
 
ngiamourisCommented:
Are you calling the localToGlobal function of the datagrid object itself?
eg myGrid.localToGlobal(myPoint)
0
 
andrewschwabeAuthor Commented:
I wasn't and tried that just now, and no that doesn't work either -- it still returns 0,0 no matter what.  I think this must be a bug...
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.