diff --git a/src/as/com/threerings/flash/SimpleTextButton.as b/src/as/com/threerings/flash/SimpleTextButton.as index bc065856..effc344f 100644 --- a/src/as/com/threerings/flash/SimpleTextButton.as +++ b/src/as/com/threerings/flash/SimpleTextButton.as @@ -27,6 +27,7 @@ import flash.display.Sprite; import flash.text.TextField; import flash.text.TextFieldAutoSize; +import flash.text.TextFormat; /** * Displays a simple button with a rounded rectangle or rectangle for a face. @@ -35,21 +36,26 @@ public class SimpleTextButton extends SimpleButton { public function SimpleTextButton ( text :String, rounded :Boolean = true, foreground :uint = 0x003366, - background :uint = 0x6699CC, highlight :uint = 0x0066FF, padding :int = 5) + background :uint = 0x6699CC, highlight :uint = 0x0066FF, padding :int = 5, + textFormat :TextFormat = null) { - upState = makeFace(text, rounded, foreground, background, padding); - overState = makeFace(text, rounded, highlight, background, padding); - downState = makeFace(text, rounded, background, highlight, padding); + upState = makeFace(text, rounded, foreground, background, padding, textFormat); + overState = makeFace(text, rounded, highlight, background, padding, textFormat); + downState = makeFace(text, rounded, background, highlight, padding, textFormat); hitTestState = upState; } protected function makeFace ( - text :String, rounded :Boolean, foreground :uint, background :uint, padding :int) :Sprite + text :String, rounded :Boolean, foreground :uint, background :uint, + padding :int, textFormat :TextFormat) :Sprite { var face :Sprite = new Sprite(); // create the label so that we can measure its size var label :TextField = new TextField(); + if (textFormat) { + label.defaultTextFormat = textFormat; + } label.text = text; label.textColor = foreground; label.autoSize = TextFieldAutoSize.LEFT;