Copy link to clipboard
Copied
Basically on frame 1 there's a symbol_mc and on frame 2 there's nothing.
I want to gotoAndStop to frame 2 when there is no cursor over symbol_mc for about 10 seconds regardless whether the cursor is on stage or off stage.
The problem is I don't know any code to deal with time or timeout or timer.
import flash.utils.Timer;
import flash.events.TimerEvent;
import flash.events.MouseEvent;
stop();
var timer:Timer = new Timer(10000,0);
timer.addEventListener(TimerEvent.TIMER,fGo);
timer.start();
function fGo(evt:TimerEvent)
{
timer.removeEventListener(TimerEvent.TIMER,fGo);
gotoAndStop(2);
}
symbol_mc.addEventListener(MouseEvent.MOUSE_OVER,fStop);
symbol_mc.addEventListener(MouseEvent.MOUSE_OUT,fReset);
function fStop(evt:MouseEvent)
{
timer.removeEventListener(TimerEvent.TIMER,fGo);
}
function fReset(evt:Mo
...
Copy link to clipboard
Copied
import flash.utils.Timer;
import flash.events.TimerEvent;
import flash.events.MouseEvent;
stop();
var timer:Timer = new Timer(10000,0);
timer.addEventListener(TimerEvent.TIMER,fGo);
timer.start();
function fGo(evt:TimerEvent)
{
timer.removeEventListener(TimerEvent.TIMER,fGo);
gotoAndStop(2);
}
symbol_mc.addEventListener(MouseEvent.MOUSE_OVER,fStop);
symbol_mc.addEventListener(MouseEvent.MOUSE_OUT,fReset);
function fStop(evt:MouseEvent)
{
timer.removeEventListener(TimerEvent.TIMER,fGo);
}
function fReset(evt:MouseEvent)
{
timer.reset();
timer.start();
timer.addEventListener(TimerEvent.TIMER,fGo);
}
Copy link to clipboard
Copied
Excellent the code works as expected, this thread is solved.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more