开发者

putting variables value into .text

开发者 https://www.devze.com 2022-12-24 23:38 出处:网络
How can I input varables value into a textfield? var i:uint=0 for(i; i<4; i++){ pageText.text=i+1 } If i use i+\"something\" then it 开发者_如何学运维can get the i value, but other than that it

How can I input varables value into a textfield?

var i:uint=0

for(i; i<4; i++){
pageText.text=i+1
}

If i use i+"something" then it 开发者_如何学运维can get the i value, but other than that it could not get i value.


The text property of TextField is expecting a string. Use toString to convert the int.

var i:uint=0

for(i; i<4; i++){
    pageText.text=i.toString();
}


Try:

var pageText:TextField = new TextField();
var i:uint=0
this.addchild(pageText)

for(i; i<4; i++)
{
    pageText.text=i
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号