Global to Local Mouse Cordinates
in my Controller Class:
stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveListener);
//for snapping my object to a grid
//im using this algorithm
protected function mouseMoveListener(e:MouseEvent):void {
brick.x = mouseX - mouseX%theGrid.getGridSize();
brick.y = mouseY - mouseY%theGrid.getGridSize();
}
brick it's inside a container and its position in x axis is 200px
When the brick is moving, the x and y value are based on stage x and y mouse.
The 0 in the stage should correspond to -200 inside my container.
How can i use globalToLocal method?
instead write:
brick.x = (mouseX - mouseX%theGrid.getGridSize())-200;
?
thanks