PDA

View Full Version : Easy Timer Question


xx3ddfan
06-24-2010, 04:13 AM
I don't want my movie clip to play unless the person's mouse is on the movie clip for more than a second. How do I code that?


stop();

var myTimer:Timer = new Timer(1000, 1);
myTimer.addEventListener(TimerEvent.TIMER, timerListener);
function timerListener (e:TimerEvent):void{
gotoAndPlay("over1");
}

image1.addEventListener(MouseEvent.MOUSE_OVER, image1overFunc);
function image1overFunc(e:MouseEvent):void {
myTimer.start();

}

flashGeneral
06-26-2010, 01:23 AM
Try changing TIMER to TIMER_COMPLETE:
stop();
var myTimer:Timer = new Timer(1000, 1);
myTimer.addEventListener(TimerEvent.TIMER_COMPLETE , timerListener);
function timerListener(e:TimerEvent):void {
gotoAndPlay("over1");
}
image1.addEventListener(MouseEvent.MOUSE_OVER, image1overFunc);
function image1overFunc(e:MouseEvent):void {
myTimer.start();
}