473,378 Members | 1,401 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Need help with a countdown script

Hi there.

Im very new to making games in flash, although I have used flash for quite some time now in web-based situations so I know my way around.
Anyways, I thought it would be fun to try making some sort of game and I got stuck… :P I managed to get a clock counting down from 30 to 0 and then collect the score but I get in trouble when i try to make a button that restarts the procedure since i then get the doubled clock speed counting down, i fixed this by making two versions of the same thing one with -1 in time and one with -0 that would be used for restarting and it worked flawlessly, until now.
I made a second game-style in the menu and then i need to have -1 in time there if someone wants to start there so back at square one… Is there anyway to reset the scripts for time when the score is collected so that when I start over I dont get the double script? my script for the countdown looks like this:

setInterval(countdown,1000); time = 30; function countdown() { time = time-1; if (time<=0) { gotoAndStop(“done”); } }

It cant be that setInterval(countdown,1000); gets doubled because then it would take twice as long time for each second to tick down and it goes faster so thats not the problem, and it can be the { time = time-1; that gets doubled either, then it would tick down 2 numbers for each second…? I really dont have any clue to why I get a faster countdown in the time when i restart…

Here’s how it behaves:
1st time: all normal
2nd time: 30 normal 29,28 fast, 27 normal, 26,25 fast, 24 normal and so on
3rd time: 30,29,28 fast 27 normal, 26,25,24 fast…
And it just keeps increasing in speed for every time I restart…

Any ideas?
Jan 10 '08 #1
0 2342

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Hameed Khan | last post by:
hi all, i am getting some problems with my first socket script. can any one of you point me why this is happening. the server script suppose to accept one connection at a time and send countdown...
5
by: Matt Stanley | last post by:
I am using the countdown script developed by Chris Nott on his website(http://www.dithered.com/javascript/countdown/example.html). The script counts down the days, hours, minutes and seconds to a...
1
by: Roel | last post by:
Hello, I have a simple script that will reload http://website/CAM1picture.jpg every xx minutes. I'm trying to add a form <input type="submit" value="CAM1" name="B1"><input type="submit"...
6
by: Michael | last post by:
I would like to display the time counting down on a webpage when I use this script.... Is it possible? <script language="JavaScript"> <!-- var tID = 0; var startTime = null; var...
4
by: Christine | last post by:
I've implemented a countdown timer for a tutorial web page that should give the user 45 minutes to complete the test, only to find that the timer is slowly 'losing' time. On average, it actually...
4
by: henrik | last post by:
Hi. Can anyone tell me the python code for a simple countdown from eg. 2.00 minutes. It should be printet out to the screen. When it is finished it should write "Time is up" Hope you can...
25
by: Shannon Jacobs | last post by:
The OL tag still allows for a START value, but that is now deprecated. I've found sound references that suggest the proper technique now is to control it with a style for the OL in quetion, but I...
1
by: DennyLoi | last post by:
Hi everyone. I am trying to implement a countdown timer which is displayed on my page. The counter needs to countdown from 10 seconds to 0 upon the page loading up. I tried the following, but...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.