Reputation: 365
Can i do this in actionscript 3? counter should be defined only one time when calling timer function
function timer(e:TimerEvent):void
{
static var counter=1;
trace("Times: " + counter );
}
Upvotes: 1
Views: 66
Reputation: 42186
What about:
function timer(e:TimerEvent):void
{
this.counter = this.counter || 0;
this.counter ++;
trace("Times: " + this.counter );
}
Upvotes: 0