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

How to stop a timer from another class?

New Here ,
Jun 14, 2013 Jun 14, 2013

Hi I'm trying to stop a timer in stopwatch class from MainMenu class. But my code doesn't work, here is my code:

in MainMenu class i've method:

public function pauseGame (e:MouseEvent){

     timestop = new Stopwatch();

     timestop.Stoptimer(); }

in class Stopwatch i try to stop my timer with:

public function Stoptimer(){

      timer.stop();

      timer.removeEventListener(TimerEvent.TIMER, timeFun);

      return; }

TOPICS
ActionScript
368
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

LEGEND , Jun 15, 2013 Jun 15, 2013

You need to pass a reference to the Timer to the Stoptimer class.

Translate
LEGEND ,
Jun 15, 2013 Jun 15, 2013
LATEST

You need to pass a reference to the Timer to the Stoptimer class.

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