如何垂直对齐AS3一个TextField [英] How to vertical align a TextField in AS3

查看:130
本文介绍了如何垂直对齐AS3一个TextField的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

I'm尝试垂直对齐的单一险种文本字段在AS3中一些文字。 不知道这是否可以用的TextFormat做,但我不这么认为。

I´m trying to vertical align some text in a Monoline TextField in AS3. Not sure if this can be done with TextFormat, but I don´t think so.

从来就找了一个解决方案,但没有真正的帮助。任何帮助是值得欢迎的。

I´ve looked for a solution but nothing really helpful. Any help is welcome.

谢谢!

推荐答案

您不能自动垂直对齐文本。你需要用你自己做出来。

You can't automatically vertical align text. You need to make it by your own.

这是我的工作code:

Here's my working code:

public static function verticalAlignTextField(tf: TextField): void {
    tf.y += Math.round((tf.height - tf.textHeight) / 2);
}

这篇关于如何垂直对齐AS3一个TextField的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆