如何创建一个显示整数和文本的文本字段?

发布于 2025-01-05 18:16:22 字数 205 浏览 5 评论 0原文

我正在尝试制作一个文本字段来显示玩家的分数。我将文本字段称为“分数”,并希望它显示“玩家分数:[分数]”。

现在,我的代码如下所示:

score.text = String "Player Score:" (scoreValue);

这不起作用,但我觉得它一定非常接近。这样做的正确方法是什么?

I am trying to make a textfield to display the player's score. I call the textfield "score", and want it to display "Player Score: [score]".

Right now, my code looks like this:

score.text = String "Player Score:" (scoreValue);

This isn't working, but I feel that it must be very close. What is the proper method for doing this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

绝影如岚 2025-01-12 18:16:22

您可能正在搜索 toString() 函数

var scoreValue:uint = 1234;
trace("Player Score: "+scoreValue.toString());

应该打印:Player Score: 1234

score.text = "Player Score: "+scoreValue.toString();

可能就是您所需要的。

You are probably searching for the toString() function

var scoreValue:uint = 1234;
trace("Player Score: "+scoreValue.toString());

Should print: Player Score: 1234

score.text = "Player Score: "+scoreValue.toString();

is probably what you need.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文