【问题标题】:Flash Actionscript 3 passing a number to dynamic text fieldFlash Actionscript 3 将数字传递给动态文本字段
【发布时间】:2010-01-20 00:04:33
【问题描述】:

在我的舞台上,我有一个动态文本字段(实例名称 = 生命)。

在我的动作脚本中,我创建了一个名为livesnum 的数字变量。然后在此之下,我将 textfields 值设置为 livenum 变量,但出现以下错误:

1067: Implicit coercion of a value of type Number to an unrelated type String.

我的动作如下:

var livesnum:Number = 4; //Amount of lives

lives.text = livesnum;

如何将文本字段设置为变量的数值?

【问题讨论】:

    标签: actionscript-3


    【解决方案1】:

    使用toString() 函数:

    lives.text=livesnum.toString()
    

    或使用演员String()

    lives.text=String(livesnum);
    

    【讨论】:

      猜你喜欢
      • 2013-03-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-07-15
      • 1970-01-01
      • 1970-01-01
      • 2010-12-10
      • 1970-01-01
      相关资源
      最近更新 更多