2013-10-15 82 views

回答

0

什么时候被定义只有一个时间:

function timer(e:TimerEvent):void 
{ 
    this.counter = this.counter || 0; 
    this.counter ++; 
    trace("Times: " + this.counter); 
} 
+0

感谢,u能解释一下吗? – Alex

+0

@Alex此行:'this.counter = this.counter || 0;'检查计数器是否在定时器函数运行的范围内定义,并在定义的情况下使用它,如果未定义,则创建一个新的计数器。在这之后简单地递增它.. – Cherniv