From 54ac003a1bc5dc0da4426f72220f0ac647a4fb74 Mon Sep 17 00:00:00 2001 From: Ray Greenwell Date: Fri, 9 May 2008 21:33:59 +0000 Subject: [PATCH] Encapsulate the annoyance in a method. git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@491 ed5b42cb-e716-0410-a449-f6a68f950b19 --- src/as/com/threerings/flash/TextFieldUtil.as | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/as/com/threerings/flash/TextFieldUtil.as b/src/as/com/threerings/flash/TextFieldUtil.as index 7ff8fa17..81c70aa8 100644 --- a/src/as/com/threerings/flash/TextFieldUtil.as +++ b/src/as/com/threerings/flash/TextFieldUtil.as @@ -89,6 +89,17 @@ public class TextFieldUtil return f; } + /** + * Update the defaultTextFormat for the specified field, as well as all text therein. + */ + public static function updateFormat (field :TextField, props :Object) :void + { + var f :TextFormat = field.defaultTextFormat; // this gets a clone of the default fmt + Util.init(f, props); // update the clone + field.defaultTextFormat = f; // set it as the new default + field.text = field.text; // jiggle the text to update it + } + /** * Include the specified TextField in a set of TextFields in which only * one may have a selection at a time.