flex - When handling a flash.events.MouseEvent, how do I find the localX/Y with respect to the currentTarget? -


I have a component that draws a grid of things and I have a small highlight square that will highlight the square of the mouse The mouse should follow the mouse for it is currently over.

The entire grid is basically just a big phantom (this is a very large grid and it was faster than using pre-existing components) and Highlight Square is another Phantom which I am according to the position of the mouse. Trying to roam around.

So, I have a mouse event. The mouse handler attached to the grid phantom and tries to determine where the mouse is and which square is above it, the highlight square can be taken to the right place. I was using localx / locale wi for this, But as soon as I take the highlight spot under the mouse, they become local to highlight and not the grid!

I was also working with Stage X / Y, but it seems that when the platform is scrolled or your component is hidden in nested display containers it becomes very useless.

Actually, I suppose you want to check grid components, mousex and mouseover properties that you Mouse coordinates will give relative to that component. Then a little math should be able to give you the grid element you have over.


Comments