Making a custom cursor in flash as3, I have replaced the cursor with a broomstick (simple vector movieclip). The code is the standard custom cursor code below:
private function listeners():void {
this.addEventListener(MouseEvent.MOUSE_MOVE, attachBroom);
}
private function attachBroom(e:MouseEvent):void
{
broomStick.x = e.stageX - 10;
broomStick.y = e.stageY - 5;
e.updateAfterEvent();
}
SWF can be found here. The cursor is fine while on top of the actual smoke alarm graphic, but when it goes over the background, it lags severely when the mouse is moved at a 'fast' speed.
Try this instead of yours
private function listeners():void {
this.addEventListener(Event.ENTER_FRAME, attachBroom);
}
private function attachBroom(e:Event):void
{
broomStick.x = stage.mouseX - 10;
broomStick.y = stage.mouseY - 5;
}
the logic is same but ENTER_FRAME event is faster than MOUSE_EVENTS. Also there is no updataAfterEvent for ENTER_FRAME.