Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

TIME in ACTIONSCRIPT

Guest
Mar 11, 2011 Mar 11, 2011

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.

TOPICS
ActionScript
557
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Deleted User
Mar 11, 2011 Mar 11, 2011

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

...
Translate
Guest
Mar 11, 2011 Mar 11, 2011

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);
}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 11, 2011 Mar 11, 2011
LATEST

Excellent the code works as expected, this thread is solved.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines