[COLOR=#000000][FONT=verdana]I’m trying to run a function when after a specific amount of time of the mouse being idle a movieclip plays, then when the mouse becomes active again a different movieclip plays. I have gotten my code work for the most part, but the last function runs over and over as the mouse is moving. I want it to run once, so the movieclip plays once. [/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]here is my code:[/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]standstill = 0;[/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]lastmove = 0;[/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]timeout = 3000; [/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]this.onMouseUp = function(){[/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]lastmove = getTimer(); idle(timeout);[/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]};[/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]this.onMouseMove = function(){[/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]lastmove = getTimer(); idle(timeout);[/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]};[/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]aListener = new Object();[/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]aListener.onKeyUp = function () {[/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]lastmove = getTimer(); idle(timeout);};[/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]Key.addListener(aListener);[/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]function idle(time){[/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]this.onEnterFrame = function(){[/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]standstill = getTimer()- lastmove; [/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]trace(standstill);[/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]DogSleep.gotoAndPlay(2);[/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]if(standstill >= time){ [/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]trace(“dog is sleeping”);[/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]this.onEnterFrame = null; [/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]standstill = 0;[/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]this.onMouseMove = function(){[/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]DogSleep.gotoAndPlay(300);[/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]}[/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]}[/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]}[/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]}[/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]how do I do this? [/FONT][/COLOR][COLOR=#000000][FONT=verdana]any help is appreciated. [/FONT][/COLOR][COLOR=#000000][FONT=verdana]Thanks![/FONT][/COLOR]