Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > General > Gaming and Game Development

Reply
 
Thread Tools Rate Thread Display Modes
Old 07-23-2012, 08:51 PM   #1
Digg00
Registered User
 
Join Date: Jul 2012
Posts: 3
Default [AS2] Simple Timer issue

So been working on a simple quizz game and faced an unexpected problem that neither even hours of googling nor endless usage of the search tool couldn't had helped. In the attachment there's the issue excluded. You see each time you click "Next" the old timer countdown is added to the new countdown

The issue is that I can't get the timer from running on background. Obviously missing a specific code to stop it from running but apparently can't get any of them to work on that one.

The timer has a code of
Quote:
timer = 30;
countdown = function(){
timer--;
if(timer==0){
delete onEnterFrame;
clearInterval(countdownInterval);
_root.gotoAndPlay(2); // (don't mind this one)
gotoAndPlay(1);
}
}
countdownInterval = setInterval(countdown,1000);
Button has the code of
Quote:
on (release) {
_root.tekstilaatikot_mc.kys_vaarin_1_mc.gotoAndSto p(12);
_root.timerii_mc.gotoAndStop(1);
_root.tekstit_mc.nextFrame();
_root.voitit_mc.gotoAndStop(2);
gotoAndPlay(2);
}
And couldn't had found the solution how to make the timer from running on background. I think it's because both the buttons and timers are covered by seperated movie clips but that's needed on the project

Thanks and sorry if this sounded stupid
Attached Files
File Type: zip timer.zip (9.8 KB, 60 views)
Digg00 is offline   Reply With Quote
Old 07-24-2012, 07:43 PM   #2
Digg00
Registered User
 
Join Date: Jul 2012
Posts: 3
Default

Solved

Being retarded and stupid. The answer was much simplier. I tried dozens of variations of clearInterval on the button but due to them being in different movieclips couldn't get it working.

It was very simple and I should had solved it much faster. It was in a need of
Quote:
clearInterval(_root.timerii_mc.countdownInterval);
(Got me to wrong lead as I had the timer in the 3rd frame of timerii_mc so didn't think of that being so simple)
Digg00 is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:23 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.