<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Flash User &#187; timer</title>
	<atom:link href="http://www.flashuser.net/tag/timer/feed" rel="self" type="application/rss+xml" />
	<link>http://www.flashuser.net</link>
	<description>Useful and daily inspiration resources from web design, css, wordpress, graphic design, photography, illustrator, photoshop.</description>
	<lastBuildDate>Fri, 03 Feb 2012 11:23:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Tips &amp; Tricks 6: How to Create a Countdown Timer in Actionscript 3.0</title>
		<link>http://www.flashuser.net/flash-tricks/how-to-create-a-countdown-timer-in-actionscript-30.html</link>
		<comments>http://www.flashuser.net/flash-tricks/how-to-create-a-countdown-timer-in-actionscript-30.html#comments</comments>
		<pubDate>Thu, 09 Jul 2009 14:06:56 +0000</pubDate>
		<dc:creator>flashuser</dc:creator>
				<category><![CDATA[ActionScript 3.0]]></category>
		<category><![CDATA[Flash Tips & Tricks]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[timer]]></category>

		<guid isPermaLink="false">http://www.flashuser.net/?p=376</guid>
		<description><![CDATA[I will show you how to create a simple yet effective countdown timer in ActionScript 3.0. It counts from days to seconds and it&#8217;s useful when you schedule anniversaries, appointments, holidays. 1. Create a dynamic TextField and aligned to the right. 2. Give it an instance name, I call it countdown_txt. 3. In the first frame of the scene open the Actions tab and paste this code: Example: 
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_retirement_as3_993855525"
			class="flashmovie"
			width="200"
			height="100">
	<param name="movie" value="http://www.flashuser.net/flash-files/flash_tips_tricks/6/retirement_as3.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://www.flashuser.net/flash-files/flash_tips_tricks/6/retirement_as3.swf"
			name="fm_retirement_as3_993855525"
			width="200"
			height="100">
	<!--<![endif]-->
		 
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>]]></description>
			<content:encoded><![CDATA[<p>I will show you how to create a simple yet effective countdown timer in ActionScript 3.0. It counts from days to seconds and it&#8217;s useful when you schedule anniversaries, appointments, holidays.</p>
<p>1. Create a dynamic TextField and aligned to the right.<br />
<span id="more-376"></span><br />
2. Give it an instance name, I call it <em>countdown_txt</em>.</p>
<p>3. In the first frame of the scene open the Actions tab and paste this code:</p>
<pre class="brush: as3; title: ; notranslate">
this.addEventListener(&quot;enterFrame&quot;,startMovie);

function startMovie(e:Event) {

	var today:Date = new Date();
	var curTime = today.getTime();

	var myRetirement:Date = new Date(2050, 7, 9);// 2050 August 9 -- months are from 0 to 11

	var myRetirementTime = myRetirement.getTime();// get the time in miliseconds of myRetirement
	var timeLeft = myRetirementTime-curTime;

	var seconds = Math.floor(timeLeft/1000);
	var minutes = Math.floor(seconds/60);
	var hours = Math.floor(minutes/60);
	var days = Math.floor(hours/24);
	var years = Math.floor(days/365);

	seconds = String(seconds%60);

	if (seconds.length&lt;2) {
		seconds = &quot;0&quot;+seconds;
	}
	minutes = String(minutes%60);

	if (minutes.length&lt;2) {
		minutes = &quot;0&quot;+minutes;
	}
	hours = String(hours%24);

	if (hours.length&lt;2) {
		hours = &quot;0&quot;+hours;
	}
	days = String(days%365);

	if (days.length&lt;2) {
		days = &quot;0&quot;+days;
	}
	years = String(years);

	var count:String = years+&quot;:&quot;+days+&quot;:&quot;+hours+&quot;:&quot;+minutes+&quot;:&quot;+seconds;
	countdown_txt.text = count;
}
</pre>
<p><strong>Example:</strong></p>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_retirement_as3_1397383769"
			class="flashmovie"
			width="200"
			height="100">
	<param name="movie" value="http://www.flashuser.net/flash-files/flash_tips_tricks/6/retirement_as3.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://www.flashuser.net/flash-files/flash_tips_tricks/6/retirement_as3.swf"
			name="fm_retirement_as3_1397383769"
			width="200"
			height="100">
	<!--<![endif]-->
		<br />
 <!-- Begin Alternate Content --></p>
<p>
 <a href="http://adobe.com/go/getflashplayer"><br />
<img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /><br />
</a>
 </p>
<p><!-- End Alternate Content --></p>

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
]]></content:encoded>
			<wfw:commentRss>http://www.flashuser.net/flash-tricks/how-to-create-a-countdown-timer-in-actionscript-30.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced

Served from: www.flashuser.net @ 2012-02-04 07:09:37 -->
