tdsm
08-20-2008, 03:17 PM
Hi guys,
This is becoming a real issue for me... I am developing a small drawing application for a machine with next to no RAM and slow processor.
Here's a stripped down version of the code so you can see what I mean;
function doDraw(e:MouseEvent):void {
graphics.lineTo(mouseX,mouseY);
e.updateAfterEvent();
}
function stopDraw(e:MouseEvent):void {
trace("end drawing");
stage.removeEventListener(MouseEvent.MOUSE_MOVE,do Draw);
}
function startDraw(e:MouseEvent):void {
graphics.moveTo(mouseX,mouseY);
stage.addEventListener(MouseEvent.MOUSE_MOVE,doDra w,false,0,true);
}
graphics.lineStyle(1,0x000000);
stage.addEventListener(MouseEvent.MOUSE_UP,stopDra w,false,0,true);
stage.addEventListener(MouseEvent.MOUSE_DOWN,start Draw,false,0,true);
When the user presses the mouse button, a MOUSE_MOVE event listener is added which draws to the stage. A MOUSE_UP event removes the move listener. This all works as expected on my development machine, but on the slooooooow machine, it seems as if the MOUSE_MOVE event is blocking the MOUSE_UP from firing, so unless I stop moving my mouse, it continues to draw even when my mouse is up.
Even the buttonDown test returns true! The stopDraw function finally gets called when I stop moving the mouse and the mouse button is not down.
I even tried setting priorities when adding event listeners but this does not work either.
This is becoming a real issue for me... I am developing a small drawing application for a machine with next to no RAM and slow processor.
Here's a stripped down version of the code so you can see what I mean;
function doDraw(e:MouseEvent):void {
graphics.lineTo(mouseX,mouseY);
e.updateAfterEvent();
}
function stopDraw(e:MouseEvent):void {
trace("end drawing");
stage.removeEventListener(MouseEvent.MOUSE_MOVE,do Draw);
}
function startDraw(e:MouseEvent):void {
graphics.moveTo(mouseX,mouseY);
stage.addEventListener(MouseEvent.MOUSE_MOVE,doDra w,false,0,true);
}
graphics.lineStyle(1,0x000000);
stage.addEventListener(MouseEvent.MOUSE_UP,stopDra w,false,0,true);
stage.addEventListener(MouseEvent.MOUSE_DOWN,start Draw,false,0,true);
When the user presses the mouse button, a MOUSE_MOVE event listener is added which draws to the stage. A MOUSE_UP event removes the move listener. This all works as expected on my development machine, but on the slooooooow machine, it seems as if the MOUSE_MOVE event is blocking the MOUSE_UP from firing, so unless I stop moving my mouse, it continues to draw even when my mouse is up.
Even the buttonDown test returns true! The stopDraw function finally gets called when I stop moving the mouse and the mouse button is not down.
I even tried setting priorities when adding event listeners but this does not work either.