<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Creating a date countdown timer in ActionScript 3 / Flash</title>
	<atom:link href="http://blog.anselmbradford.com/2009/08/03/creating-a-date-countdown-timer-in-actionscript-3-flash/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.anselmbradford.com/2009/08/03/creating-a-date-countdown-timer-in-actionscript-3-flash/</link>
	<description>wrangling the Internet's wildest</description>
	<lastBuildDate>Tue, 07 Sep 2010 17:22:10 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: Ans</title>
		<link>http://blog.anselmbradford.com/2009/08/03/creating-a-date-countdown-timer-in-actionscript-3-flash/comment-page-1/#comment-10069</link>
		<dc:creator>Ans</dc:creator>
		<pubDate>Mon, 08 Mar 2010 09:17:26 +0000</pubDate>
		<guid isPermaLink="false">http://blog.anselmbradford.com/?p=873#comment-10069</guid>
		<description>I got a question about making the countdown timer blink in my provided example. To do this change the update interval (currently at one second) and change the &lt;code&gt;textColor&lt;/code&gt; property on every update. 

First open &lt;code&gt;CountDown.as&lt;/code&gt; and find:

&lt;pre lang=&quot;actionscript&quot;&gt;var ticker = new Timer(1000);&lt;/pre&gt;

and change to:

&lt;pre lang=&quot;actionscript&quot;&gt;var ticker = new Timer(500);&lt;/pre&gt;

So that it fires every half a second.

Then open &lt;code&gt;Main.as&lt;/code&gt; and find:

&lt;pre lang=&quot;actionscript&quot;&gt;
	days.digit.text = daysLeft;
	hours.digit.text = hoursLeft;
	minutes.digit.text = minutesLeft;
	seconds.digit.text = secondsLeft;
&lt;/pre&gt;

Replace this with:

&lt;pre lang=&quot;actionscript&quot;&gt;
	var origDays:int = days.digit.text;
	var origHours:int = hours.digit.text;
	var origMins:int = minutes.digit.text;
	var origSecs:int = seconds.digit.text;
			
	if (origDays-daysLeft != 0) 
	{
		days.digit.text = daysLeft;
		days.digit.textColor = 0xff0000;
	}
	else
	{
		days.digit.textColor = 0x000000;
	}
			
	if (origHours-hoursLeft != 0) 
	{
		hours.digit.text = hoursLeft;
		hours.digit.textColor = 0xff0000;
	}
	else
	{
		hours.digit.textColor = 0x000000;
	}
			
	if (origMins-minutesLeft != 0) 
	{
		minutes.digit.text = minutesLeft;
		minutes.digit.textColor = 0xff0000;
	}
	else
	{
		minutes.digit.textColor = 0x000000;
	}
			
	if (origSecs-secondsLeft != 0) 
	{
		seconds.digit.text = secondsLeft;
		seconds.digit.textColor = 0xff0000;
	}
	else
	{
		seconds.digit.textColor = 0x000000;
	}
&lt;/pre&gt;

This checks if the digit is updating, if it is, change the color to red, otherwise change it to black. Since the timer is firing every half a second the seconds will blink red.</description>
		<content:encoded><![CDATA[<p>I got a question about making the countdown timer blink in my provided example. To do this change the update interval (currently at one second) and change the <code>textColor</code> property on every update. </p>
<p>First open <code>CountDown.as</code> and find:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">var</span> ticker = <span style="color: #000000; font-weight: bold;">new</span> Timer<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1000</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>and change to:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">var</span> ticker = <span style="color: #000000; font-weight: bold;">new</span> Timer<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">500</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>So that it fires every half a second.</p>
<p>Then open <code>Main.as</code> and find:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">	days.<span style="color: #006600;">digit</span>.<span style="color: #0066CC;">text</span> = daysLeft;
	hours.<span style="color: #006600;">digit</span>.<span style="color: #0066CC;">text</span> = hoursLeft;
	minutes.<span style="color: #006600;">digit</span>.<span style="color: #0066CC;">text</span> = minutesLeft;
	seconds.<span style="color: #006600;">digit</span>.<span style="color: #0066CC;">text</span> = secondsLeft;</pre></div></div>

<p>Replace this with:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">	<span style="color: #000000; font-weight: bold;">var</span> origDays:<span style="color: #0066CC;">int</span> = days.<span style="color: #006600;">digit</span>.<span style="color: #0066CC;">text</span>;
	<span style="color: #000000; font-weight: bold;">var</span> origHours:<span style="color: #0066CC;">int</span> = hours.<span style="color: #006600;">digit</span>.<span style="color: #0066CC;">text</span>;
	<span style="color: #000000; font-weight: bold;">var</span> origMins:<span style="color: #0066CC;">int</span> = minutes.<span style="color: #006600;">digit</span>.<span style="color: #0066CC;">text</span>;
	<span style="color: #000000; font-weight: bold;">var</span> origSecs:<span style="color: #0066CC;">int</span> = seconds.<span style="color: #006600;">digit</span>.<span style="color: #0066CC;">text</span>;
&nbsp;
	<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>origDays-daysLeft <span style="color: #66cc66;">!</span>= <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span> 
	<span style="color: #66cc66;">&#123;</span>
		days.<span style="color: #006600;">digit</span>.<span style="color: #0066CC;">text</span> = daysLeft;
		days.<span style="color: #006600;">digit</span>.<span style="color: #0066CC;">textColor</span> = 0xff0000;
	<span style="color: #66cc66;">&#125;</span>
	<span style="color: #b1b100;">else</span>
	<span style="color: #66cc66;">&#123;</span>
		days.<span style="color: #006600;">digit</span>.<span style="color: #0066CC;">textColor</span> = 0x000000;
	<span style="color: #66cc66;">&#125;</span>
&nbsp;
	<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>origHours-hoursLeft <span style="color: #66cc66;">!</span>= <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span> 
	<span style="color: #66cc66;">&#123;</span>
		hours.<span style="color: #006600;">digit</span>.<span style="color: #0066CC;">text</span> = hoursLeft;
		hours.<span style="color: #006600;">digit</span>.<span style="color: #0066CC;">textColor</span> = 0xff0000;
	<span style="color: #66cc66;">&#125;</span>
	<span style="color: #b1b100;">else</span>
	<span style="color: #66cc66;">&#123;</span>
		hours.<span style="color: #006600;">digit</span>.<span style="color: #0066CC;">textColor</span> = 0x000000;
	<span style="color: #66cc66;">&#125;</span>
&nbsp;
	<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>origMins-minutesLeft <span style="color: #66cc66;">!</span>= <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span> 
	<span style="color: #66cc66;">&#123;</span>
		minutes.<span style="color: #006600;">digit</span>.<span style="color: #0066CC;">text</span> = minutesLeft;
		minutes.<span style="color: #006600;">digit</span>.<span style="color: #0066CC;">textColor</span> = 0xff0000;
	<span style="color: #66cc66;">&#125;</span>
	<span style="color: #b1b100;">else</span>
	<span style="color: #66cc66;">&#123;</span>
		minutes.<span style="color: #006600;">digit</span>.<span style="color: #0066CC;">textColor</span> = 0x000000;
	<span style="color: #66cc66;">&#125;</span>
&nbsp;
	<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>origSecs-secondsLeft <span style="color: #66cc66;">!</span>= <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span> 
	<span style="color: #66cc66;">&#123;</span>
		seconds.<span style="color: #006600;">digit</span>.<span style="color: #0066CC;">text</span> = secondsLeft;
		seconds.<span style="color: #006600;">digit</span>.<span style="color: #0066CC;">textColor</span> = 0xff0000;
	<span style="color: #66cc66;">&#125;</span>
	<span style="color: #b1b100;">else</span>
	<span style="color: #66cc66;">&#123;</span>
		seconds.<span style="color: #006600;">digit</span>.<span style="color: #0066CC;">textColor</span> = 0x000000;
	<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>This checks if the digit is updating, if it is, change the color to red, otherwise change it to black. Since the timer is firing every half a second the seconds will blink red.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
