diff --git a/src/as/com/threerings/flex/ChatInput.as b/src/as/com/threerings/flex/ChatInput.as index 4749b975..ff156a4d 100644 --- a/src/as/com/threerings/flex/ChatInput.as +++ b/src/as/com/threerings/flex/ChatInput.as @@ -7,6 +7,11 @@ import flash.events.FocusEvent; import mx.controls.TextInput; +/** + * The class name of an image to use as the input prompt. + */ +[Style(name="prompt", type="Class")] + /** * A special TextInput for entering Chat. One of these is used in ChatControl. * @@ -18,14 +23,34 @@ public class ChatInput extends TextInput { public function ChatInput () { - styleName = "chatInput"; width = 147; showPrompt(true); } + override public function stylesInitialized () :void + { + super.stylesInitialized(); + + checkShowPrompt(); + } + + override public function styleChanged (styleProp :String) :void + { + super.styleChanged(styleProp); + + if (styleProp == "prompt") { + checkShowPrompt(); + } + } + + protected function checkShowPrompt () :void + { + showPrompt(focusManager == null || focusManager.getFocus() != this); + } + protected function showPrompt (show :Boolean) :void { - setStyle("backgroundImage", (show && ("" == text)) ? PROMPT : undefined); + setStyle("backgroundImage", (show && ("" == text)) ? getStyle("prompt") : undefined); } override protected function focusInHandler (event :FocusEvent) :void @@ -46,8 +71,5 @@ public class ChatInput extends TextInput super.focusOutHandler(event); showPrompt(true); } - - [Embed(source="typetochat.png")] - protected static const PROMPT :Class; } } diff --git a/src/as/com/threerings/flex/typetochat.png b/src/as/com/threerings/flex/typetochat.png deleted file mode 100644 index 5cd2807d..00000000 Binary files a/src/as/com/threerings/flex/typetochat.png and /dev/null differ