中间的 Flash 垂直文本对齐

标签 flash actionscript-3

我一直在寻找一种以编程方式默认设置动态文本框在框中间垂直对齐的方法。我发现很难相信没有办法做到这一点,除非我太盲目了。否则我怎么能伪造它?

谢谢!

最佳答案

var parentContainer:DisplayObjectContainer = ...;
var textField:TextField = ...;
textField.autoSize = TextFieldAutoSize.CENTER; 
// set width, height, wordWrap etc if needed

//after setting the text or in the textInput event handler if the 
//textField is user editable
textField.y = parentContainer.height * 0.5 - textField.textHeight * 0.5;

关于中间的 Flash 垂直文本对齐,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1568181/

相关文章:

php - 使用PHP脚本将上传的图像转换为PNG

actionscript-3 - Shape、Sprite、MovieClip 等显示对象 : when to use?

php - 错误#2007,在AS3中,但它跟踪正确的结果,当添加var文本字段时,它在动态文本框中显示Null

flash - 麦克风检测 Actionscript 3

file - Cortex-M3 闪存限制

flash - 将 Flash 视频转换为 HTML5

actionscript-3 - 如何与 worker 一起创建弹性项目?

actionscript-3 - 为什么 Actionscript 3 ENTER_FRAME 事件如此疯狂?

flash - AS3 中的自定义广播事件?

html - 变形验证码的想法