Number()函数的疑问 //已解决


this.createTextField(“counter_txt”, this.getNextHighestDepth(), 0, 0, 100, 22);
counter_txt.autoSize = true;
counter_txt.text = 0;
function incrementInterval():Void {
var counter:Number = counter_txt.text; //也可在这里,将counter_txt.text转化为Number数据类型,Number(counter_txt.text)
// Without the Number() function, Flash would concatenate the value instead
// of adding values. You could also use “counter_txt.text++;”
counter_txt.text = Number(counter) + 1; //之前创建counter变量的时候,数据类型已经设置为Number了,为什么这里还要再转换为数字?
var intervalID:Number = setInterval(incrementInterval, 1000);



Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s