<?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 simple timer in Flex with the flash.utils.Timer class</title>
	<atom:link href="http://blog.flexexamples.com/2007/08/14/creating-a-simple-timer-in-flex-with-the-flashutilstimer-class/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.flexexamples.com/2007/08/14/creating-a-simple-timer-in-flex-with-the-flashutilstimer-class/</link>
	<description>Just a bunch of Adobe Flex Examples</description>
	<lastBuildDate>Fri, 19 Mar 2010 20:35:16 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Giorgos</title>
		<link>http://blog.flexexamples.com/2007/08/14/creating-a-simple-timer-in-flex-with-the-flashutilstimer-class/comment-page-1/#comment-6819</link>
		<dc:creator>Giorgos</dc:creator>
		<pubDate>Thu, 21 Jan 2010 16:09:06 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/08/14/creating-a-simple-timer-in-flex-with-the-flashutilstimer-class/#comment-6819</guid>
		<description>For those who need to add hours 
You need to add another mask var 
&lt;code&gt;
private const HRS_MASK:String = &quot;00&quot;;
&lt;/code&gt;
then inside the t listener keeping peterd advice i add this
&lt;code&gt;
var ms:Number = getTimer() - baseTimer
var d:Date = new Date(0, 0, 0, 0, 0, 0, ms);
var hrs:String = (HRS_MASK + d.hours).substr(-HRS_MASK.length);
&lt;/code&gt;
and at the end you need to change the TIMER_INTERVAL:int from 10 to 1000

great post, well done!</description>
		<content:encoded><![CDATA[<p>For those who need to add hours<br />
You need to add another mask var<br />
<code><br />
private const HRS_MASK:String = "00";<br />
</code><br />
then inside the t listener keeping peterd advice i add this<br />
<code><br />
var ms:Number = getTimer() - baseTimer<br />
var d:Date = new Date(0, 0, 0, 0, 0, 0, ms);<br />
var hrs:String = (HRS_MASK + d.hours).substr(-HRS_MASK.length);<br />
</code><br />
and at the end you need to change the TIMER_INTERVAL:int from 10 to 1000</p>
<p>great post, well done!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ed</title>
		<link>http://blog.flexexamples.com/2007/08/14/creating-a-simple-timer-in-flex-with-the-flashutilstimer-class/comment-page-1/#comment-6700</link>
		<dc:creator>ed</dc:creator>
		<pubDate>Tue, 29 Dec 2009 15:52:02 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/08/14/creating-a-simple-timer-in-flex-with-the-flashutilstimer-class/#comment-6700</guid>
		<description>Try using the full class name in the calls. I was getting this same error and this worked to correct it:

change 
var t:Timer;

to:
var t:flash.utils.Timer;

and change
t = new Timer(TIMER_INTERVAL);

to 
t = new flash.utils.Timer(TIMER_INTERVAL);

I do not know the cause of the name collision, but this will get around it.</description>
		<content:encoded><![CDATA[<p>Try using the full class name in the calls. I was getting this same error and this worked to correct it:</p>
<p>change<br />
var t:Timer;</p>
<p>to:<br />
var t:flash.utils.Timer;</p>
<p>and change<br />
t = new Timer(TIMER_INTERVAL);</p>
<p>to<br />
t = new flash.utils.Timer(TIMER_INTERVAL);</p>
<p>I do not know the cause of the name collision, but this will get around it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter deHaan</title>
		<link>http://blog.flexexamples.com/2007/08/14/creating-a-simple-timer-in-flex-with-the-flashutilstimer-class/comment-page-1/#comment-5918</link>
		<dc:creator>Peter deHaan</dc:creator>
		<pubDate>Sat, 03 Oct 2009 14:59:51 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/08/14/creating-a-simple-timer-in-flex-with-the-flashutilstimer-class/#comment-5918</guid>
		<description>@notzipo,

I just tried w/ Flex SDK 3.4 and wasn&#039;t able to reproduce the error.
Which version of the Flex SDK/Flash Player are you using? And on which OS?

Peter</description>
		<content:encoded><![CDATA[<p>@notzipo,</p>
<p>I just tried w/ Flex SDK 3.4 and wasn&#8217;t able to reproduce the error.<br />
Which version of the Flex SDK/Flash Player are you using? And on which OS?</p>
<p>Peter</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: notzipo</title>
		<link>http://blog.flexexamples.com/2007/08/14/creating-a-simple-timer-in-flex-with-the-flashutilstimer-class/comment-page-1/#comment-5916</link>
		<dc:creator>notzipo</dc:creator>
		<pubDate>Sat, 03 Oct 2009 12:18:48 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/08/14/creating-a-simple-timer-in-flex-with-the-flashutilstimer-class/#comment-5916</guid>
		<description>i got this error too.

flex builder 3</description>
		<content:encoded><![CDATA[<p>i got this error too.</p>
<p>flex builder 3</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sideDoor</title>
		<link>http://blog.flexexamples.com/2007/08/14/creating-a-simple-timer-in-flex-with-the-flashutilstimer-class/comment-page-1/#comment-5866</link>
		<dc:creator>sideDoor</dc:creator>
		<pubDate>Mon, 28 Sep 2009 01:48:33 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/08/14/creating-a-simple-timer-in-flex-with-the-flashutilstimer-class/#comment-5866</guid>
		<description>Thanks for this, plugged-right-in nicely!
sd</description>
		<content:encoded><![CDATA[<p>Thanks for this, plugged-right-in nicely!<br />
sd</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gerson</title>
		<link>http://blog.flexexamples.com/2007/08/14/creating-a-simple-timer-in-flex-with-the-flashutilstimer-class/comment-page-1/#comment-5801</link>
		<dc:creator>Gerson</dc:creator>
		<pubDate>Wed, 16 Sep 2009 22:27:48 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/08/14/creating-a-simple-timer-in-flex-with-the-flashutilstimer-class/#comment-5801</guid>
		<description>Hi, thanks for the post.

For the guys asking about the pause and resume functionality, this is the code I have added to make this work. 

&lt;pre lang=&quot;actionscript3&quot;&gt;
      private var pauseTimer:int;

      private function pause():void {
    	      pauseTimer = getTimer() - baseTimer;
    	      t.stop();
      }
    
      private function resume():void {
    	      var delta:int = getTimer() - baseTimer - pauseTimer;
    	      baseTimer = baseTimer + delta;
    	      t.start();
      }
&lt;/pre&gt;

This methods are called from the corresponding buttons in this way:

&lt;code&gt;
      
      
&lt;/code&gt;

Hope this helps.

Regards</description>
		<content:encoded><![CDATA[<p>Hi, thanks for the post.</p>
<p>For the guys asking about the pause and resume functionality, this is the code I have added to make this work.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;">      <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> pauseTimer<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span>;
&nbsp;
      <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #004993;">pause</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
    	      pauseTimer = <span style="color: #004993;">getTimer</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">-</span> baseTimer;
    	      t.<span style="color: #004993;">stop</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
      <span style="color: #000000;">&#125;</span>
&nbsp;
      <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #004993;">resume</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
    	      <span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">delta</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span> = <span style="color: #004993;">getTimer</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">-</span> baseTimer <span style="color: #000000; font-weight: bold;">-</span> pauseTimer;
    	      baseTimer = baseTimer <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #004993;">delta</span>;
    	      t.<span style="color: #004993;">start</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
      <span style="color: #000000;">&#125;</span></pre></div></div>

<p>This methods are called from the corresponding buttons in this way:</p>
<p><code></p>
<p></code></p>
<p>Hope this helps.</p>
<p>Regards</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: NXFX</title>
		<link>http://blog.flexexamples.com/2007/08/14/creating-a-simple-timer-in-flex-with-the-flashutilstimer-class/comment-page-1/#comment-5120</link>
		<dc:creator>NXFX</dc:creator>
		<pubDate>Wed, 12 Aug 2009 14:19:59 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/08/14/creating-a-simple-timer-in-flex-with-the-flashutilstimer-class/#comment-5120</guid>
		<description>Thanks,

awesome for beginners, you should add an entry with an option to count down ;)

Thanks</description>
		<content:encoded><![CDATA[<p>Thanks,</p>
<p>awesome for beginners, you should add an entry with an option to count down ;)</p>
<p>Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Daniel</title>
		<link>http://blog.flexexamples.com/2007/08/14/creating-a-simple-timer-in-flex-with-the-flashutilstimer-class/comment-page-1/#comment-4888</link>
		<dc:creator>Daniel</dc:creator>
		<pubDate>Sat, 01 Aug 2009 16:55:33 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/08/14/creating-a-simple-timer-in-flex-with-the-flashutilstimer-class/#comment-4888</guid>
		<description>Thanks for your post. It works OK. You gave me an idea for a banner dynamic flex.</description>
		<content:encoded><![CDATA[<p>Thanks for your post. It works OK. You gave me an idea for a banner dynamic flex.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ana</title>
		<link>http://blog.flexexamples.com/2007/08/14/creating-a-simple-timer-in-flex-with-the-flashutilstimer-class/comment-page-1/#comment-609</link>
		<dc:creator>Ana</dc:creator>
		<pubDate>Mon, 27 Apr 2009 09:11:22 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/08/14/creating-a-simple-timer-in-flex-with-the-flashutilstimer-class/#comment-609</guid>
		<description>I tried with the same code. Unfortunately i too getting the same error mentioned earlier by huy.
Any solution to it. Pls find below for details.

Error is on line : t = new Timer(TIMER_INTERVAL);

Comments : Incorrect number of arguments. Expected no more than 0.</description>
		<content:encoded><![CDATA[<p>I tried with the same code. Unfortunately i too getting the same error mentioned earlier by huy.<br />
Any solution to it. Pls find below for details.</p>
<p>Error is on line : t = new Timer(TIMER_INTERVAL);</p>
<p>Comments : Incorrect number of arguments. Expected no more than 0.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: vetarvomagla</title>
		<link>http://blog.flexexamples.com/2007/08/14/creating-a-simple-timer-in-flex-with-the-flashutilstimer-class/comment-page-1/#comment-610</link>
		<dc:creator>vetarvomagla</dc:creator>
		<pubDate>Wed, 21 Jan 2009 13:55:35 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/08/14/creating-a-simple-timer-in-flex-with-the-flashutilstimer-class/#comment-610</guid>
		<description>Did someone has this example with pause and resume?</description>
		<content:encoded><![CDATA[<p>Did someone has this example with pause and resume?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
