Timer will work, but using callLater() will probably be more efficient,
since it will only wait a single frame.
Tracy
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Fotis Chatzinikos
Sent: Friday, October 24, 2008 6:20 AM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Refresh Screen Counter
the following sample code will not display a counter but 40...
A for loop will run these repetitions in nearly no time...
Use a timer function with a delay:
[Bindable]
var s:String ;
...inside the timer driven function update the String:
{
...
s = counter.ToString() ;
}
then to display it anywhere: mx:Label text={s}/
On Fri, Oct 24, 2008 at 7:08 AM, itdanny2002 [EMAIL PROTECTED]
mailto:[EMAIL PROTECTED] wrote:
I have below sample code which display
the result of counter. How can I
display the progress by using some
screen refresh function ?
?xml version=1.0 encoding=utf-8?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml
http://www.adobe.com/2006/mxml
layout=absolute
mx:Script
![CDATA[
private function Counter():void{
for (var i:int;i 40;i++){
counter.text = i.toString();
}
}
]]
/mx:Script
mx:Button x=37 y=36 label=Button click=Counter();/
mx:Label id=counter x=37 y=10 text=Label/
/mx:Application
--
Fotis Chatzinikos, Ph.D.
Founder,
Phinnovation
[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] ,