
as3 中我写了了动态文本te:TextField = new TextField();addChild(te);问一下te怎样在舞台中央显示呢?
展开全部
要正确显示,需要先给它赋值,文本框有了内容后,尺寸往往会改变。文字内容改变后:
te.width=te.textWidth+6;
te.height=te.textHeight+4;
te.x=(stage.stageWidth-te.width)/2;
te.y=(stage.stageHeight-te.heigth)/2;
这样就完全在舞台居中
te.width=te.textWidth+6;
te.height=te.textHeight+4;
te.x=(stage.stageWidth-te.width)/2;
te.y=(stage.stageHeight-te.heigth)/2;
这样就完全在舞台居中
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询