TextField没有添加到舞台

时间:2014-11-24 19:43:12

标签: actionscript-3 flash actionscript flash-cs5

无法将文本字段添加到舞台中。

public function create(tot:Number, tot2:Number, xp:Number, yp:Number):void
        {
            var txt:TextField = new TextField();
            var format:TextFormat = new TextFormat();
            format.font = "Verdana";
            format.color = 0xFF0000;
            format.size = 10;
            format.underline = true;
            txt.defaultTextFormat = format;

            if (tot != tot2)
            {
                txt.text = String(tot - tot2);
                txt.x = xp;
                txt.y = yp;
                trace(tot - tot2);
                trace(xp + " + " + yp);
                addChild(txt);
            }
        }

这是主时间轴上的代码:

mt.create(rtg.chk(inp.text,dyn.text,Total,str), Total, mouseX, mouseY);

我已经尝试过stage.addChild(),root,尝试通过MC添加它。真的很难过。

trace函数在tf中返回我想要的细节,但它只是没有创建。

干杯。

0 个答案:

没有答案
相关问题