Now, I will teach you How To Making Date Countdown in Flash. It’s very simple tutorial, you can change the Years, Month and Dates in the script code. In this tutorial, we must use Actionscript 3.0. So, follow step by step to got the best result and watch the Videos.
See The Videos!
1. Open Adobe Flash.
2. Choose Actionscript 3.0.
3. In the Properties panel or right click choose Document Properties, change the Width 300 px and Height 200 px.
4. Click File > Import > Import to Library. Choose the images as background.
5. When showing “Import Fireworks Document”, click OK.
6. In the Library panel, drag the Images to the stages.
7. In the Timeline panel, change the name of Layer 1 to “Background”. And click Lock icon to Lock the background.
8. Click New Layer icon in the bottom of Timeline panel.
9. Change the name “TextField”.
10. Click Text Tool in the Tool Box.
11. In the Character panel, choose the Font “_sans”, and size “20 pt”.
12. Create 2 Text Box in the stage.
13. On the Properties panel, give the name “date_txt”. Choose “Classic Text” and Choose text as “Dynamic Text”.
14. On the first Text Box, give the name “date text”.
15. Click the second Text Box, on the Properties panel, give the name “countdown_txt”. And don’t forget choose Text as “Classic Text” and “Dynamic Text”.
And still on the second text, give the name “countdown text”.
16. Click New Layer icon in the bottom of Timeline panel and give the name “Actionscript”.
17. Still in the Actionscript layer, right click, choose Action.
18. When opened, give this script.
// USER CONFIG SETTINGS
var countdownYear:Number = 2012; // 20xx
var countdownMonth:Number = 1; // 1-12
var countdownDay:Number = 23; // 1-31
date_txt.text = countdownMonth+"/"+countdownDay+"/"+countdownYear; // date formatting
// USER CONFIG SETTINGS // EVENTS AND TIME CALCULATIONS
var static_date:Date = new Date(countdownYear, countdownMonth-1, countdownDay, 0, 0, 0, 0);
addEventListener(Event.ENTER_FRAME, fl_updateCountdown);
function fl_updateCountdown(evt:Event):void
{
var now_date:Date = new Date();
var nowCountdown:Number = static_date.time - now_date.time;
var dayTill = ((((nowCountdown/1000)/60)/60)/24);
var hoursTill = (((((nowCountdown/1000)/60)/60)/24) - Math.floor(dayTill))*24;
var minTill = ((((((nowCountdown/1000)/60)/60)/24) - Math.floor(dayTill))*24 - Math.floor(hoursTill))*60;
var secTill = (((((((nowCountdown/1000)/60)/60)/24) - Math.floor(dayTill))*24 - Math.floor(hoursTill))*60 - Math.floor(minTill))*60; countdown_txt.text = Math.floor(dayTill)+"days "+Math.floor(hoursTill)+"hrs "+Math.floor(minTill)+"min "+Math.floor(secTill)+"sec";
}
// END
19. To test the movie, click Control > Test Movie or press CTRL + Enter.
20. And this is the result.
REMEMBER!: In the Action – Panel, you can change the Year, Month, and Date. See the picture below!
0 comments:
Post a Comment