counter



import fl.text.TLFTextField;
import flashx.textLayout.formats.TextLayoutFormat;
import flashx.textLayout.elements.TextFlow;



var my_speed:Number = 5;
var my_timer:Timer;
var counter:Number=0;
var _total:Number = 5;

my_timer=new Timer(my_speed*100);
my_timer.addEventListener(TimerEvent.TIMER, increment);
my_timer.start();

function increment(e:TimerEvent):void {
counter++;
//trace(counter);
if (counter==_total) {
counter=0;

}
dec_.text = String(counter);

}


/* ------------- ---------*/

var my_playback_counter:Number=0;
var my_total:Number = 5;
var ar_count:Number;

var myTimer:Timer = new Timer(100 * my_total);

myTimer.addEventListener(TimerEvent.TIMER, decrement);
function decrement (e:TimerEvent):void{
my_playback_counter--;
ar_count = my_playback_counter + my_total;

if (ar_count==0) {
my_playback_counter=0;
}

// trace(ar_count);
inc_.text = String(ar_count);
}
myTimer.start();

0 comments:

Post a Comment