google+javascriptbanktwitter@js_bankfacebook@jsbankrss@jsbank






Construire Countdown Simple Timer Flash en ActionScript Compte ? rebours pour un ?v?nement semble ?tre une chose indispensable dans la vie moderne des ressources humaines, nous pouvons les voir pendant les vacances de No?l, nouvelle ann?e, anniversaire, etc Ou facilement, nous pouvons les voir tous les jours dans les r?veils - les compteurs ? z?ro simple compte ? rebours dans notre vie
JavaScript jQuery compte ? rebours avec Bar affichage

? Plus 10 minuteries ? rebours Awesome ? No?l 2010

? JavaScript compte ? rebours solution en POO

? Super Timer compte ? rebours Neat JavaScript
compte ? rebours en Flash environnement avec ActionScript.


Gratuit iPage h�bergement Web pour la premi�re ann�e MOMENT



Si vous �tes toujours � la recherche d'un fournisseur d'h�bergement Web fiable avec des tarifs abordables, pourquoi vous ne prenez pas un peu de temps pour essayer iPage, seulement avec $1.89/month, inclus $500+ Cr�dits suppl�mentaires gratuites pour le paiement de 24 mois ($45)?

Plus de 1.000.000 de clients + existisng peuvent pas avoir tort, vraiment vous n'�tes pas aussi! Plus important encore, lorsque vous enregistrez l'h�bergement web � iPage gr�ce � notre lien, nous allons �tre heureux de renvoyer un plein remboursement. C'est g�nial! Vous devriez essayer iPage h�bergement web GRATUITEMENT maintenant! Et contactez-nous pour tout ce que vous devez savoir sur iPage.
Essayez iPage GRATUIT premi�re ann�e MOMENT

The Settings:
The first thing in our code is deciding if our timer is going to blink every second or not. Blinking gives the impressing of time passing and is easier to notice then just one or two numbers incrementing. Just set "blinking" to true or false

View Code ACTIONSCRIPT
/** timer settings  ****************************************************************/
var blinking:Boolean = true;	// allow timers to blink every second
var osecs:Number = 0; 			//used to enable flashing

The Dates:
The countdown timer takes a future date and figures out how many days, hours, mins, and seconds from now until that date arrives. The next thing we need to do is enter in our future date for the timer to count to. To make things easy, the date is broken into year, month, day, hour, min, sec, and millisecond.

View Code ACTIONSCRIPT
/** date settings  ****************************************************************/
// set the target date
var timeToYear:Number = 2012; 	// full year 2010

var timeToMonth:Number = 12; 	// month 1 - 12
var timeToDate:Number = 21; 	// date 1 - 31 depending on month

var timeToHour:Number = 0; 		// hour 0 - 23
var timeToMin:Number = 0; 		// min 0 - 59

var timeToSec:Number = 0; 		// sec 0 - 59
var timeToMilSec:Number = 0; 	// milliseconds 0 - 999

Dealing with Time-Zones:
Most timers need to sync across time-zones, this can be a pain, complicated by day-light savings. We only need to set a time-zone offset if our timer's target date based on a particular location and we wanted people from other locals to countdown at the exact same time. Say we have an event occurring in New York City, we want everyone in the world to know the exact time the event is going to occur. We will need to set "timeZone" to -5 for eastern standard time unless the date falls in the summer time, then we should use -4 for eastern daylight time.

View Code ACTIONSCRIPT
var timeZone:Number =  0;	// time-zone offset - set this if the target time is time-zone based.

The Target Date vs. Todays Date:
After all the settings are made, it is time to setup our current date and compare it to a future date. Since we do not want our countdown timer to count if our target date has past, then we need to check for that. If the target date is not in the future we will reset all the values to 0 and stop the timer.

View Code ACTIONSCRIPT
// gets todays date as Universal Time 
var today:Date = new Date(Date.UTC());

 
// sets the target date as Universal Time
var targDate:Date = new Date(Date.UTC(timeToYear,timeToMonth - 1,timeToDate,timeToHour,timeToMin,timeToSec,timeToMilSec));

 
// check to make sure target date is in the future
if(targDate < today){
	targDate = today;
}

The Magic:
Here is where all the magic happens. We create a new date on every frame, add the time-zone offset then compare it to the target date. The difference of the two dates is what we use to fill in the countdown clock. In this timer we are counting down by days, but we could modify it to count down years and months as well. When we compare dates, the value that is returned is in milliseconds, so we have to convert that very large number into our desired time increment.

var days:Number = ((((target date - current date) / 1000)/60)/60)/24;
This line of code takes the target date and subtracts the current date which returns the difference in milliseconds. To convert the difference into our base time we need to divide.

Here are some samples for converting different time increments from milliseconds to create out base time increment.

milliseconds
target date - current date

seconds
(target date - current date) / 1000

minutes
((target date - current date) / 1000)/60

hours
(((target date - current date) / 1000)/60)/60

days
((((target date - current date) / 1000)/60)/60)/24;

months (A)
getting this value is more complex, here is a rough, quick value.
((((((target date - current date) / 1000)/60)/60)/24)/365)*12

months (B)
for more exact values, we will need to get the difference in months using Date.getMonth().
1. get the years
var yearsTill:Number = ((((((target date - current date) / 1000)/60)/60)/24)/365);

2. get the difference in months
var monthsTill:Number = target date - current date .getMonth() - today.getMonth();

3. check if the amount of months is a negative number
if(monthsTill < 0){
    mulitply years by 12, then add the amount of months till the end of the year.
    trace((Math.floor(yearsTill) * 12) + (11 + monthsTill));
}
else{
    multiply years by 12, plus the difference in months.
    trace((Math.floor(yearsTill) * 12) + (monthsTill));
}

years
(((((target date - current date) / 1000)/60)/60)/24)/365

After we get a value for our base increment, we round it down (Math.floor()) and take the remainder to create all of the smaller increments. In the line below, we take the total days and subtract the days rounded down. This returns a percent of a day so we need to multiply it by 24 to get the total amount of hours. We will repeat this process, until we have reduced the remaining value into all of the smaller time increments.

hours = (total days - Math.floor(total days))*24;
minutes = (total hours - Math.floor(total hours))*60;
seconds = Math.floor((total minutes - Math.floor(total minutes))*60);

View Code ACTIONSCRIPT
/** timer animation magic  ********************************************************/
// start on Enterframe event and handler only if target date is in the future
if(targDate > today){

	this.onEnterFrame = function(){
 
			// if target date is not in the future, stop counter.
			var dateArr:Date = new Date(Date.UTC());
			if(dateArr >= targDate){

				days.dyt.text = "000";
				hrs.hrt.text = "00";
				mins.mnt.text = "00";
				secs.sct.text = "00";

 
				delete this.onEnterFrame;
				return;
			}
 
			// set the hours and adjust if there is time-zone offset
			dateArr.setHours(dateArr.getHours() + timeZone);

 
			// DAYS - get the time difference in days
			var daysData:Number = ((((targDate - dateArr) / 1000)/60)/60)/24;
			// round down days

			var daysTill:Number = Math.floor(daysData);
 
			// HOURS - get the difference in hours

			var hoursData:Number = (daysData - Math.floor(daysData))*24;
			//round down hours

			var hoursTill:Number = Math.floor(hoursData);
 
			// MINUTES - get the difference in minutes

			var minsData:Number = (hoursData - Math.floor(hoursData))*60;
			// round down minutes

			var minsTill:Number = Math.floor(minsData);
 
			// SECONDS - get difference in seconds

			var secsTill:Number = Math.floor((minsData - Math.floor(minsData))*60);

 
			// do timer blinking every second (if enabled)
			var blinkThis:Boolean = false;
			if(secsTill != osecs){

				if(blinking){
					blinkThis = true;
				}
			}
			osecs = secsTill;

 
 
			// format days till number
			if(daysTill > 99){
				days.dyt.text = daysTill;
			}

			else if(daysTill > 9){
				days.dyt.text = "0" + daysTill;
			}

			else{
				days.dyt.text = "00" + daysTill;
			}
 

			// add timer info to the correct text fields
			if(!blinkThis){
				hoursTill < 10 ? hrs.hrt.text = "0" + hoursTill: hrs.hrt.text = hoursTill;
				minsTill < 10 ? mins.mnt.text = "0" + minsTill: mins.mnt.text = minsTill;
				secsTill < 10 ? secs.sct.text = "0" + secsTill: secs.sct.text = secsTill;
			}

			else{
				// handle blinking (if enabled)
				days.dyt.text = "";
				hrs.hrt.text = "";
				mins.mnt.text = "";
				secs.sct.text = "";
				blinkThis = false;
			}

	}
}

You can download a source FLA here.

AIVideo-App.com
Générez vos vidéos d'entreprise par l'IA avec la voix ou simplement du texte

chatGPTaz.com
Parlez à ChatGPT dans votre langue maternelle

AppAIVidéo
Votre première application vidéo AI GRATUITE

Deepfake Video
Deepfake AI Video Maker

Deepfake
Deepfake AI Video Maker

AI Deep Fake
Deepfake AI Video Maker

AIvidio
AI Video Mobile Solutions

AIvideos
AI Video Platform & Solutions

AIvedio
AI Video App Maker

Artificial General Intelligence
Ai and higher level Artificial General Intelligence (AGI)

Artificial General Intelligence
Ai and higher level Artificial General Intelligence (AGI)

Faceswap AI en ligne
Échangez des visages, des vidéos, des photos et des GIF instantanément avec de puissants outils d'IA - Faceswap AI Online GRATUIT

Faceswap AI en ligne
Échangez des visages, des vidéos, des photos et des GIF instantanément avec de puissants outils d'IA - Faceswap AI Online GRATUIT

Faceswap AI en ligne
Échangez des visages, des vidéos, des photos et des GIF instantanément avec de puissants outils d'IA - Faceswap AI Online GRATUIT

Powerful AI Presentation PPT Maker for FREE
Build an impressive presentation with our free online AI presentation app

Your next top AI Assistant
Claude AI, developed by Anthropic

Your next top AI Assistant
Claude AI, developed by Anthropic

Temu gratuit 500 $ pour les nouveaux utilisateurs
Claim Free Temu $500 Credit via Affiliate & Influencer Program

Crédits publicitaires TikTok gratuits
Maîtrisez les publicités TikTok pour le marketing de votre entreprise

Dall-E-OpenAI.com
Générez automatiquement des images créatives avec l'IA

chatGPT4.win
Parlez à ChatGPT dans votre langue maternelle

Premier produit d'intelligence artificielle d'Elon Musk - Grok/UN.com
Parlez au chatbot Grok AI dans votre langue

Outily.win
Centre d'outils ouvert et gratuit, utilisable par tous et pour tous, avec des centaines d'outils

GateIO.gomymobi.com
Airdrops gratuits à réclamer et à partager jusqu'à 150 000 $ par projet

iPhoneKer.com
Économisez jusqu'à 630 $ à l'achat d'un nouvel iPhone 16

Acheter le robot Tesla Optimus
Commandez votre robot Tesla Bot : Optimus Gen 2 dès aujourd'hui pour moins de 20 000 $

JavaScript par jour


Google Safe Browsing McAfee SiteAdvisor Norton SafeWeb Dr.Web