Actionscript 3 为什么第二行文字在舞台重新调整尺寸时消失了动作脚本3?

Actionscript 3 为什么第二行文字在舞台重新调整尺寸时消失了动作脚本3?,actionscript-3,air,flash-builder,Actionscript 3,Air,Flash Builder,我有这个密码。它会在舞台上创建两行文本,但当舞台被重新调整大小时,第二行文本会在舞台被缩放时消失。有人知道为什么会这样吗?提前感谢您的帮助 var text:TextField=new TextField(); var textFormat:TextFormat = new TextFormat(); textFormat.color=0x000000; textFormat.size=45; textFormat.bold=true; textFormat.font="Impact"; tex

我有这个密码。它会在舞台上创建两行文本,但当舞台被重新调整大小时,第二行文本会在舞台被缩放时消失。有人知道为什么会这样吗?提前感谢您的帮助

var text:TextField=new TextField();
var textFormat:TextFormat = new TextFormat();
textFormat.color=0x000000;
textFormat.size=45;
textFormat.bold=true;
textFormat.font="Impact";
textFormat.italic=true;
text.x=8;
text.y=5;
text.width=200;
text.text = "Line One\nLine two";
text.setTextFormat(textFormat);
text.height=text.textHeight +4;
sprite.addChild(text);

然后将精灵添加到舞台。

请尝试以下代码:

var text:TextField=new TextField();
var textFormat:TextFormat = new TextFormat();
textFormat.color=0x000000;
textFormat.size=45;
textFormat.bold=true;
textFormat.font="Impact";
textFormat.italic=true;
text.x = 8;
text.border = true;
text.y=5;
text.width=200;
text.text = "Line One\nLine two";
text.setTextFormat(textFormat);
text.autoSize = TextFieldAutoSize.LEFT;
sprite.addChild(text);

请注意,添加了自动大小,这似乎解决了您的问题。

因此,它可以工作,但除非我删除斜体,否则就是切割末端。奇怪,谢谢您的帮助!我不知道。看看这个问题和答案:在行后添加空格也有帮助,还有其他解决方案,但大部分是黑客作业。