Joe
Joe

Reputation: 1057

MouseX and MouseY not working as expected

I have an old flash app that worked ok when double the size of what it is now. The problem is, there is nowhere in the script that does math with MouseX and MouseY, i use the position directly so I do not know why its missbehaving now. These are the functions that are using the mouse.

        private function startPencilTool(e:MouseEvent):void
    {
        pencilDraw = new Shape();
        board.addChild(pencilDraw);

        pencilDraw.graphics.moveTo(mouseX, mouseY);
        pencilDraw.graphics.lineStyle(hardint2, activeColor, hardint);

        board.addEventListener(MouseEvent.MOUSE_MOVE, drawPencilTool);
    }

    private function drawPencilTool(e:MouseEvent):void
    {
        pencilDraw.graphics.lineTo(mouseX, mouseY);
    }

    private function stopPencilTool(e:MouseEvent):void
    {
        board.removeEventListener(MouseEvent.MOUSE_MOVE, drawPencilTool);
    }

This is how it is acting http://ugleh.com/DrawingApp4.swf

When I tried offsetting the results it didn't help much either for some reason.

Upvotes: 1

Views: 1118

Answers (1)

Ivan Chernykh
Ivan Chernykh

Reputation: 42166

You should try these properties : board.mouseX , e.localX , e.stageX

Upvotes: 1

Related Questions