-
Countdown assistance needed.
Hello all. I am a web designer and have used flash for years; but I am definitely NOT an action-script person. I am using flash MX 2004
(therefore AS2). I want to make a 10 minute countdown timer utilizing AS2 and Dynamic Text. The final product would be on a green background and be used to overlay another video (using green screen software). Anyway; I want to start the timer at 10:00 and have it holdat 00:00.
Unfortunately; pretty much all the tutorials out there are countdown till a date or time and NOT a simple countdown for X amount of minutes. Like I mentioned flash is not the issue for me....the AS is tho so guidance here would be awesome.
Thanks in advance.
-
Designer, Programmer, Musician
http://www.mediafire.com/?nghdemz4jd8mmy5 Counter by Angel Hdz
Hope that helps. Any questions let me know
Already mastering AS3. It was so fun. Now into Javascript and PHP and all its libraries
-
Designer, Programmer, Musician
My bad! I made it 10 seconds! It's 10 minutes!!!! Let me fix it
Already mastering AS3. It was so fun. Now into Javascript and PHP and all its libraries
-
.
Hi,
Make a text field with instance name of "CountDown"
and use this on the timeline:
PHP Code:
StartTime = getTimer();
Countdown = 600000;// 10 Minutes
OneHour = 3600000;
OneMinute = 60000;
OneSecond = 1000;
onEnterFrame = function ()
{
TimePassed = getTimer() - StartTime;
CountDown.text = TimeConvert(Countdown - TimePassed);
};
function TimeConvert(ShowTheTime)
{
PassedHour = Math.floor(ShowTheTime / OneHour);
Remaining = ShowTheTime - (PassedHour * OneHour);
PassedMinutes = Math.floor(Remaining / OneMinute);
Remaining = Remaining - (PassedMinutes * OneMinute);
PassedSeconds = Math.floor(Remaining / OneSecond);
Remaining = Remaining - (PassedSeconds * OneSecond);
PassedHundrs = Math.floor(Remaining / 10);
if (PassedHour < 10)
{
Hours = "0" + PassedHour.toString();
}
else
{
Hours = PassedHour.toString();
}
if (PassedMinutes < 10)
{
Minutes = "0" + PassedMinutes.toString();
}
else
{
Minutes = PassedMinutes.toString();
}
if (PassedSeconds < 10)
{
Seconds = "0" + PassedSeconds.toString();
}
else
{
Seconds = PassedSeconds.toString();
}
if (PassedHundrs < 10)
{
Hundredths = "0" + PassedHundrs.toString();
}
else
{
Hundredths = PassedHundrs.toString();
}
return Hours + ":" + Minutes + ":" + Seconds + ":" + Hundredths;
}
-
Designer, Programmer, Musician
Already mastering AS3. It was so fun. Now into Javascript and PHP and all its libraries
-
@ angelhdz both files result in a "unexpected file format" error.
@ fruitbeard can't get this to work. My dynamic text Var is named CountDown as you requested and I added an new layer where I copied the code yet nothing appears (after alt enter). Good thing is that there is no error either. I see you have also implemented hours and milliseconds...neither will be needed. All I require is 10 minute countdown in the following format 9:59 ---> 00:01 --> 00:00.
-
.
Hi,
not var name, instance name
-
Designer, Programmer, Musician
http://www.mediafire.com/?ceemtvg84wkwedf Here it is. Sorry, i made it in Flash 8 version. Now is MX 2004
Already mastering AS3. It was so fun. Now into Javascript and PHP and all its libraries
-
Sorry..my bad **fixed**. Ok now we have the timer showing but no countdown. All it shows is 00:09:59
getting there...
Last edited by Tantrix; 11-04-2012 at 01:51 PM.
-
.
Hi,
slightly changed for you.
make textfield called CountDown, instance name.
PHP Code:
StartTime = getTimer(); CountingDown = 600000;// 10 Minutes
onEnterFrame = function () { TimePassed = getTimer() - StartTime; CountDown.text = TimeConvert(CountingDown - TimePassed); if (Minutes < 1 && Seconds < 0.1) { delete onEnterFrame; trace("10 Minutes over."); } }; function TimeConvert(MyTime) { PassedMinutes = Math.floor(MyTime / 60000); Remaining = MyTime - (PassedMinutes * 60000); PassedSeconds = Math.floor(Remaining / 1000); Remaining = Remaining - (PassedSeconds * 1000); if (PassedMinutes < 10) { Minutes = "0" + PassedMinutes.toString(); } else { Minutes = PassedMinutes.toString(); } if (PassedSeconds < 10) { Seconds = "0" + PassedSeconds.toString(); } else { Seconds = PassedSeconds.toString(); } return Minutes + ":" + Seconds; }
perhaps you may need a stop(); somewhere !!!
Last edited by fruitbeard; 11-04-2012 at 02:12 PM.
-
Designer, Programmer, Musician
http://www.mediafire.com/?chl6mraphje1d05 Fixed. The timer starts at 10:00:00 then it begin to countdown 9:59:30 and it keep countdown until 0:0:0 then HOLD there until action is applied.
Already mastering AS3. It was so fun. Now into Javascript and PHP and all its libraries
-
Designer, Programmer, Musician
Fruitbeard, in your script, you have to use an IF statement, if minutes == 0 and seconds == 0, stop counting
Already mastering AS3. It was so fun. Now into Javascript and PHP and all its libraries
-
.
I do sir, but that could have been easily implemented by himself, i think.
-
Designer, Programmer, Musician
Read the first post...he/she said clearly he is not an actionscript person, so I doubt he will be able to understand your script, and stop the counting if it reaches 00:00 ....
Tantrix, check up my .fla , is fixed, and is MX 2004 compatible, and it does exactly what you asked for. Let me know if you will use this, so I don't lose my time here.
Already mastering AS3. It was so fun. Now into Javascript and PHP and all its libraries
-
.
Keep your hair on Angel, he also said in first post.
" I want to make a 10 minute countdown timer utilizing AS2 and Dynamic Text "
I'm just passing time.
-
Thank you BOTH.....for your help. Like I mentioned I am NOT a AS person (even though I have a very basic knowledge of scripting AS is rather alien to me). That being said I do need to be walked through the process. I have done a million flash projects (web banners, menus etc) but even menus only use VERY basic scripting. Beyond that I am 100% lost.
As far as my present questions are concerned I would have to say fruitbeard more closely suites my needs at this time.
I value both options and as you both know with AS there are 100 ways to do the same thing...
Last edited by Tantrix; 11-04-2012 at 02:39 PM.
-
Actually fruitbeard I have edited your first code suggestion to remove the milliseconds and the hours and it works great! I wanted the dynamic text feature so I could alter font with a single click.
Thank you for your assistance...much appreciated Since I have you here I have one more question.
What is (in your opinion) the best way to export my countdown to video file? Quality is the most important thing here.
-
Designer, Programmer, Musician
Originally Posted by fruitbeard
Keep your hair on Angel, he also said in first post.
" I want to make a 10 minute countdown timer utilizing AS2 and Dynamic Text "
I'm just passing time.
And that's exactly what i gave to him, a simple AS2 countdown with dynamic textbox on stage to visualize the countdown. The fact that i didn't added the ":" to separate the minutes, the seconds and the miliseconds, and the "0" after the minutes, doesn't mean my script is not what he asked for. If you look at my last .fla you see it clearly. Also my script holds at 0:0:0 as he said. Anyway, i'm just passing time to. I'm busy with my own proyects. I'm glad your script was choosen fruitbeard.
PD: I could removethe miliseconds if he wanted
Last edited by angelhdz; 11-04-2012 at 02:43 PM.
Already mastering AS3. It was so fun. Now into Javascript and PHP and all its libraries
-
Designer, Programmer, Musician
Originally Posted by Tantrix
Actually fruitbeard I have edited your first code suggestion to remove the milliseconds and the hours and it works great! I wanted the dynamic text feature so I could alter font with a single click.
Thank you for your assistance...much appreciated Since I have you here I have one more question.
What is (in your opinion) the best way to export my countdown to video file? Quality is the most important thing here.
Export it to Quicktime format. (You have to have any version of Quicktime installed on your system, but its the best quality format for exporting flash)
Already mastering AS3. It was so fun. Now into Javascript and PHP and all its libraries
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|