# Mouse listener and \_xmouse problem

**URL:** <https://forum.kirupa.com/t/mouse-listener-and--xmouse-problem/202369>\
**Category:** flash\
**Created:** [September 30, 2006, 6:34am UTC](https://forum.kirupa.com/t/mouse-listener-and--xmouse-problem/202369 "2006-09-30T06:34:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bandsaw](https://avatars.discourse-cdn.com/v4/letter/b/54ee81/32.png) [@bandsaw](https://forum.kirupa.com/u/bandsaw)\
**Post date:** [September 30, 2006, 6:34am UTC](https://forum.kirupa.com/t/mouse-listener-and--xmouse-problem/202369/1 "2006-09-30T06:34:27Z")

</div>

Im having a problem. Im trying to use the onMouseMove listener to detect when my \_xmouse passes 850px to scroll the nav onto the stage. The problem im running into is kinda obvious. When the \_xmouse passes 850px it keeps running the action over and over,everytime i move the mouse. I tried different conditions but it keeps scrolling out.

Heres what i have so far:

```
ActionScript Code:
[FONT=Courier New][LEFT][COLOR=#000000] **var** [/COLOR] mouseListener:[COLOR=#0000FF]Object[/COLOR] = [COLOR=#000000] **new** [/COLOR] [COLOR=#0000FF]Object[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR];
  mouseListener.[COLOR=#0000FF]onMouseMove[/COLOR] = [COLOR=#000000] **function** [/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
      [COLOR=#0000FF]if[/COLOR][COLOR=#000000]([/COLOR][COLOR=#0000FF]_root[/COLOR].[COLOR=#0000FF]_xmouse[/COLOR] &gt;= [COLOR=#000080]850[/COLOR][COLOR=#000000])[/COLOR][COLOR=#000000]{[/COLOR]
          showNav[COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR];
      [COLOR=#000000]}[/COLOR]
  [COLOR=#000000]}[/COLOR];
  [COLOR=#0000FF]Mouse[/COLOR].[COLOR=#0000FF]addListener[/COLOR][COLOR=#000000]([/COLOR]mouseListener[COLOR=#000000])[/COLOR];

```

[/LEFT]  
[/FONT]

I cant figure out how to get it to scroll out only once, when the \_xmouse passes 850px. Any help would be greatly appreciated.

Jason.
