<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.2.1" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: Creating a simple timer in Flex with the flash.utils.Timer class</title>
	<link>http://blog.flexexamples.com/2007/08/14/creating-a-simple-timer-in-flex-with-the-flashutilstimer-class/</link>
	<description>A bunch of examples for Adobe Flex and ActionScript</description>
	<pubDate>Tue, 06 Jan 2009 12:17:40 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2.1</generator>

	<item>
		<title>By: JR</title>
		<link>http://blog.flexexamples.com/2007/08/14/creating-a-simple-timer-in-flex-with-the-flashutilstimer-class/#comment-16672</link>
		<author>JR</author>
		<pubDate>Wed, 12 Nov 2008 13:23:22 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/08/14/creating-a-simple-timer-in-flex-with-the-flashutilstimer-class/#comment-16672</guid>
		<description>Absolutely a super post for a beginner in Flex such as myself.

I have been able to get the sample working without any issues and am now changing it to suit my needs.

Many thanks!</description>
		<content:encoded><![CDATA[<p>Absolutely a super post for a beginner in Flex such as myself.</p>
<p>I have been able to get the sample working without any issues and am now changing it to suit my needs.</p>
<p>Many thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peterd</title>
		<link>http://blog.flexexamples.com/2007/08/14/creating-a-simple-timer-in-flex-with-the-flashutilstimer-class/#comment-14839</link>
		<author>peterd</author>
		<pubDate>Thu, 21 Aug 2008 14:59:33 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/08/14/creating-a-simple-timer-in-flex-with-the-flashutilstimer-class/#comment-14839</guid>
		<description>huy,

Which version of the Flex SDK, Flash Player, and OS are you using?
I've never seen that error before. It may be worth filing a bug at http://bugs.adobe.com/flashplayer/ .

Peter

(PS: If you post the bug number here, a few of us can vote/subscribe.)</description>
		<content:encoded><![CDATA[<p>huy,</p>
<p>Which version of the Flex SDK, Flash Player, and OS are you using?<br />
I&#8217;ve never seen that error before. It may be worth filing a bug at <a href="http://bugs.adobe.com/flashplayer/" rel="nofollow">http://bugs.adobe.com/flashplayer/</a> .</p>
<p>Peter</p>
<p>(PS: If you post the bug number here, a few of us can vote/subscribe.)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: huy</title>
		<link>http://blog.flexexamples.com/2007/08/14/creating-a-simple-timer-in-flex-with-the-flashutilstimer-class/#comment-14832</link>
		<author>huy</author>
		<pubDate>Thu, 21 Aug 2008 08:26:22 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/08/14/creating-a-simple-timer-in-flex-with-the-flashutilstimer-class/#comment-14832</guid>
		<description>&lt;pre class="code"&gt;
t = new Timer(TIMER_INTERVAL);
&lt;/pre&gt;
===&#62;
	1137: Incorrect number of arguments.  Expected no more than 0.</description>
		<content:encoded><![CDATA[<pre class="code">
t = new Timer(TIMER_INTERVAL);
</pre>
<p>===&gt;<br />
	1137: Incorrect number of arguments.  Expected no more than 0.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: nathan</title>
		<link>http://blog.flexexamples.com/2007/08/14/creating-a-simple-timer-in-flex-with-the-flashutilstimer-class/#comment-14406</link>
		<author>nathan</author>
		<pubDate>Wed, 30 Jul 2008 22:09:20 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/08/14/creating-a-simple-timer-in-flex-with-the-flashutilstimer-class/#comment-14406</guid>
		<description>Thank you again for your posts, VERY helpful. I was utterly confused until I found that getTimer was in flash.utils - could not figure out by reading where that function came from!</description>
		<content:encoded><![CDATA[<p>Thank you again for your posts, VERY helpful. I was utterly confused until I found that getTimer was in flash.utils - could not figure out by reading where that function came from!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dylan Oliver</title>
		<link>http://blog.flexexamples.com/2007/08/14/creating-a-simple-timer-in-flex-with-the-flashutilstimer-class/#comment-14170</link>
		<author>Dylan Oliver</author>
		<pubDate>Tue, 15 Jul 2008 23:19:34 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/08/14/creating-a-simple-timer-in-flex-with-the-flashutilstimer-class/#comment-14170</guid>
		<description>Figured it out: Date produces a local time, so the displayed time must be adjusted with the offset. Beware that &lt;code&gt;getTimeZoneOffset()&lt;/code&gt; does appear to account for daylight savings time; where new &lt;code&gt;Date(0).getTimeZoneOffset()&lt;/code&gt; returns 360, &lt;code&gt;Date().getTimeZoneOffset()&lt;/code&gt; returns 300 as I'm now in Central Daylight Time.
&lt;pre class="code"&gt;
private function getDuration(obj:Object, column:DataGridColumn): String { 
    var tzOffset: int = new Date(0).getTimezoneOffset() * 60 * 1000;
    var duration: int = Objective(obj).lm ? Objective(obj).lm.video.duration*1000 : 100;
    var durationFormatter: DateFormatter = new DateFormatter();
    durationFormatter.formatString = "JJ:NN";
    return durationFormatter.format(new Date(duration + tzOffset));
}
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Figured it out: Date produces a local time, so the displayed time must be adjusted with the offset. Beware that <code>getTimeZoneOffset()</code> does appear to account for daylight savings time; where new <code>Date(0).getTimeZoneOffset()</code> returns 360, <code>Date().getTimeZoneOffset()</code> returns 300 as I&#8217;m now in Central Daylight Time.</p>
<pre class="code">
private function getDuration(obj:Object, column:DataGridColumn): String {
    var tzOffset: int = new Date(0).getTimezoneOffset() * 60 * 1000;
    var duration: int = Objective(obj).lm ? Objective(obj).lm.video.duration*1000 : 100;
    var durationFormatter: DateFormatter = new DateFormatter();
    durationFormatter.formatString = "JJ:NN";
    return durationFormatter.format(new Date(duration + tzOffset));
}
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dylan Oliver</title>
		<link>http://blog.flexexamples.com/2007/08/14/creating-a-simple-timer-in-flex-with-the-flashutilstimer-class/#comment-14169</link>
		<author>Dylan Oliver</author>
		<pubDate>Tue, 15 Jul 2008 22:05:58 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/08/14/creating-a-simple-timer-in-flex-with-the-flashutilstimer-class/#comment-14169</guid>
		<description>I'm having the same problem with hours .. with 3900 (seconds) input as duration into the following function, it yields 19:05 instead of the expected 01:05:
&lt;pre class="code"&gt;
private function getDuration(obj:Object, column:DataGridColumn): String { 
    var duration: int = Objective(obj).lm ? Objective(obj).lm.video.duration*1000 : 100;
    var durationFormatter: DateFormatter = new DateFormatter();
    durationFormatter.formatString = "JJ:NN";
    return durationFormatter.format(new Date(duration));
}
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>I&#8217;m having the same problem with hours .. with 3900 (seconds) input as duration into the following function, it yields 19:05 instead of the expected 01:05:</p>
<pre class="code">
private function getDuration(obj:Object, column:DataGridColumn): String {
    var duration: int = Objective(obj).lm ? Objective(obj).lm.video.duration*1000 : 100;
    var durationFormatter: DateFormatter = new DateFormatter();
    durationFormatter.formatString = "JJ:NN";
    return durationFormatter.format(new Date(duration));
}
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nicole</title>
		<link>http://blog.flexexamples.com/2007/08/14/creating-a-simple-timer-in-flex-with-the-flashutilstimer-class/#comment-12797</link>
		<author>Nicole</author>
		<pubDate>Tue, 20 May 2008 12:28:05 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/08/14/creating-a-simple-timer-in-flex-with-the-flashutilstimer-class/#comment-12797</guid>
		<description>How would you add hours to this??  I attempted it but my hours started out at 18:00:00?

Nicole</description>
		<content:encoded><![CDATA[<p>How would you add hours to this??  I attempted it but my hours started out at 18:00:00?</p>
<p>Nicole</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David</title>
		<link>http://blog.flexexamples.com/2007/08/14/creating-a-simple-timer-in-flex-with-the-flashutilstimer-class/#comment-12527</link>
		<author>David</author>
		<pubDate>Tue, 06 May 2008 13:06:53 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/08/14/creating-a-simple-timer-in-flex-with-the-flashutilstimer-class/#comment-12527</guid>
		<description>Managed to get what I was looking for with this below. It works for what I'm looking for. Not sure if its correct. Thanks for the start.

&lt;pre class="code"&gt;
import flash.utils.Timer;
import flash.events.TimerEvent;

private const TIMER_INTERVAL:int = 10;

private var appTime:Timer;

private function startClock():void 
{
    appTime = new Timer(TIMER_INTERVAL);
    appTime.addEventListener(TimerEvent.TIMER, updateTimer);
    appTime.start();
}

private function updateTimer(event:TimerEvent):void 
{
    var currentDate:Date = new Date();
    dateAndTimeDisplay.text = timeDisplayFormatter.format(currentDate);
}
&lt;/pre&gt;

Cheers
David</description>
		<content:encoded><![CDATA[<p>Managed to get what I was looking for with this below. It works for what I&#8217;m looking for. Not sure if its correct. Thanks for the start.</p>
<pre class="code">
import flash.utils.Timer;
import flash.events.TimerEvent;

private const TIMER_INTERVAL:int = 10;

private var appTime:Timer;

private function startClock():void
{
    appTime = new Timer(TIMER_INTERVAL);
    appTime.addEventListener(TimerEvent.TIMER, updateTimer);
    appTime.start();
}

private function updateTimer(event:TimerEvent):void
{
    var currentDate:Date = new Date();
    dateAndTimeDisplay.text = timeDisplayFormatter.format(currentDate);
}
</pre>
<p>Cheers<br />
David</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David</title>
		<link>http://blog.flexexamples.com/2007/08/14/creating-a-simple-timer-in-flex-with-the-flashutilstimer-class/#comment-12524</link>
		<author>David</author>
		<pubDate>Tue, 06 May 2008 10:14:25 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/08/14/creating-a-simple-timer-in-flex-with-the-flashutilstimer-class/#comment-12524</guid>
		<description>Peter,

Great Blog finding it a great help learning flex and actionscript. I was wonder if you could use the above method to display the system time on an appliction so the current user can see the date and the time? Or is there another method for that?

Thanks
David</description>
		<content:encoded><![CDATA[<p>Peter,</p>
<p>Great Blog finding it a great help learning flex and actionscript. I was wonder if you could use the above method to display the system time on an appliction so the current user can see the date and the time? Or is there another method for that?</p>
<p>Thanks<br />
David</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Wannes</title>
		<link>http://blog.flexexamples.com/2007/08/14/creating-a-simple-timer-in-flex-with-the-flashutilstimer-class/#comment-7801</link>
		<author>Wannes</author>
		<pubDate>Sat, 22 Mar 2008 14:39:25 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/08/14/creating-a-simple-timer-in-flex-with-the-flashutilstimer-class/#comment-7801</guid>
		<description>Thanks Peter!</description>
		<content:encoded><![CDATA[<p>Thanks Peter!</p>
]]></content:encoded>
	</item>
</channel>
</rss>
