From ad347a4c8d4dfeab7891e96402db7dbdb104f5d1 Mon Sep 17 00:00:00 2001 From: Ray Greenwell Date: Wed, 30 Apr 2008 20:15:28 +0000 Subject: [PATCH] Allow the defaultTextFormat initProps to be specified more conveniently. git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@478 ed5b42cb-e716-0410-a449-f6a68f950b19 --- src/as/com/threerings/flash/TextFieldUtil.as | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/as/com/threerings/flash/TextFieldUtil.as b/src/as/com/threerings/flash/TextFieldUtil.as index 3c52f243..7ff8fa17 100644 --- a/src/as/com/threerings/flash/TextFieldUtil.as +++ b/src/as/com/threerings/flash/TextFieldUtil.as @@ -51,11 +51,11 @@ public class TextFieldUtil * @param initProps contains properties with which to initialize the TextField. * Additionally it may contain the following properties: * outlineColor: uint - * - * initProps may be destructively modified. + * @param formatProps contains properties with which to initialize the defaultTextFormat. */ public static function createField ( - text :String, initProps :Object = null, clazz :Class = null) :TextField + text :String, initProps :Object = null, formatProps :Object = null, clazz :Class = null) + :TextField { var tf :TextField = (clazz == null) ? new TextField() : TextField(new clazz()); @@ -64,6 +64,9 @@ public class TextFieldUtil } Util.init(tf, initProps, null, MASK_FIELD_PROPS); + if (formatProps != null) { + tf.defaultTextFormat = createFormat(formatProps); + } tf.text = text; if (tf.autoSize != TextFieldAutoSize.NONE) { tf.width = tf.textWidth + WIDTH_PAD;