# Custom cursor trouble..?

**URL:** <https://forum.kirupa.com/t/custom-cursor-trouble/227202>\
**Category:** flash\
**Created:** [May 28, 2007, 1:06pm UTC](https://forum.kirupa.com/t/custom-cursor-trouble/227202 "2007-05-28T13:06:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jerry](https://avatars.discourse-cdn.com/v4/letter/j/5daacb/32.png) [@jerry](https://forum.kirupa.com/u/jerry)\
**Post date:** [May 28, 2007, 1:06pm UTC](https://forum.kirupa.com/t/custom-cursor-trouble/227202/1 "2007-05-28T13:06:59Z")

</div>

Hi there

I’m trying to do a simple custom cursor setup - but by some stange reason, the MouseEvent.MOUSE\_OUT triggeres not only on mouseOut, but also during the mouseMove event (not constantly though) - try moving the mouse in circles, and then keep an eye on the trace output…

Can someone tell me whats wrong…?

```auto
import flash.ui.Mouse;

var target:DisplayObjectContainer = this;

var plane:Sprite = new Sprite();
plane.graphics.beginFill(0xCCCC);
plane.graphics.drawRect(0,0,400,300);

var cursor:Sprite = new Sprite();
cursor.graphics.beginFill(0x0);
cursor.graphics.drawRect(0,0,10,10);
cursor.visible = false;

target.addChild(plane);
target.addChild(cursor);

plane.addEventListener(MouseEvent.MOUSE_OVER, handleMouseOver);
plane.addEventListener(MouseEvent.MOUSE_OUT, handleMouseOut);

function handleMouseOver(e:MouseEvent):void {
	trace("handleMouseOver");
	Mouse.hide();
	plane.addEventListener(MouseEvent.MOUSE_MOVE, moveCursor);
}

function moveCursor(e:MouseEvent):void {
	trace("moveCursor");
	cursor.x = e.localX;
	cursor.y = e.localY;
	e.updateAfterEvent();
	cursor.visible = true;
}

function handleMouseOut(e:MouseEvent):void {
	trace("handleMouseOut");
	Mouse.show();
	plane.removeEventListener(MouseEvent.MOUSE_MOVE, moveCursor);
	cursor.visible = false;
}

```
