# Different MOUSE\_OUT behavior for X and Y mousemoves?

**URL:** <https://forum.kirupa.com/t/different-mouse-out-behavior-for-x-and-y-mousemoves/303242>\
**Category:** Uncategorized\
**Created:** [January 17, 2010, 2:34pm UTC](https://forum.kirupa.com/t/different-mouse-out-behavior-for-x-and-y-mousemoves/303242 "2010-01-17T14:34:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jedierikb](https://avatars.discourse-cdn.com/v4/letter/j/f14d63/32.png) [@jedierikb](https://forum.kirupa.com/u/jedierikb)\
**Post date:** [January 17, 2010, 2:34pm UTC](https://forum.kirupa.com/t/different-mouse-out-behavior-for-x-and-y-mousemoves/303242/1 "2010-01-17T14:34:23Z")

</div>

Why are `MOUSE_OUT` events handled differently for X and Y mouse moves when leaving a Sprite?

**How do I fix this in my code?**

`MOUSE_OUT` occurs when `x==0`, but not `y==0` (you need to go to `y==-1`):

```auto
private var _sp:Sprite; 

public function test( ):void 
{ 
stage.align = StageAlign.TOP_LEFT; 
stage.scaleMode = StageScaleMode.NO_SCALE; 

_sp = new Sprite( ); 
_sp.graphics.beginFill( 0xFF0000, 1 ); 
_sp.graphics.drawRect( 0, 0, 15, 15 ); 
_sp.graphics.endFill( ); 
_sp.x = 10; 
_sp.y = 10; 
_sp.alpha = 1; 

addChild( _sp ); 

_sp.addEventListener( MouseEvent.MOUSE_MOVE, msMvCb, false, 0, true ); 
_sp.addEventListener( MouseEvent.MOUSE_OUT, msOutCb, false, 0, true ); 
} 

private function msMvCb( evt:MouseEvent ):void 
{ 
traceMousePos( "mv", evt ); 
_sp.alpha = 1; 
} 

private function msOutCb( evt:MouseEvent ):void 
{ 
traceMousePos( "out", evt ); 
_sp.alpha = .5; 
} 

private function traceMousePos( note:String, evt:MouseEvent ):void 
{ 
trace( note + " -- " + evt.localX + ", " + evt.localY + ", " + evt.stageX + ", " + evt.stageY ); 
} 

```

Here is a trace from moving straight up, with `MOUSE_OUT` on -1 …

```
mv -- 7, 3, 17, 13 
mv -- 7, 2, 17, 12 
mv -- 7, 1, 17, 11 
mv -- 7, 0, 17, 10 
out -- 7, -1, 17, 9 

```

And here is a trace from moving straight to the left, with `MOUSE_OUT` on 0 …

```
mv -- 3, 7, 13, 17 
mv -- 2, 7, 12, 17 
mv -- 1, 7, 11, 17 
out -- 0, 7, 10, 17 

```

Is this a bug? Or is there a flag somewhere I have not set?
