diff --git a/src/as/com/threerings/msoy/client/ChatControl.as b/src/as/com/threerings/msoy/client/ChatControl.as new file mode 100644 index 000000000..ab123d205 --- /dev/null +++ b/src/as/com/threerings/msoy/client/ChatControl.as @@ -0,0 +1,37 @@ +package com.threerings.msoy.client { + +import mx.containers.HBox; + +import mx.controls.Button; +import mx.controls.TextInput; + +import mx.events.FlexEvent; + +public class ChatControl extends HBox +{ + public function ChatControl (ctx :MsoyContext) + { + _ctx = ctx; + + addChild(_txt = new TextInput()); + var but :Button = new Button(); + but.label = "Send"; // TODO: xlate + addChild(but); + + _txt.addEventListener(FlexEvent.ENTER, sendChat); + but.addEventListener(FlexEvent.BUTTON_DOWN, sendChat); + } + + protected function sendChat (event :FlexEvent) :void + { + var message :String = _txt.text; + _txt.text = ""; + _ctx.getChatDirector().requestChat(null, message, true); + } + + /** Our client-side context. */ + protected var _ctx :MsoyContext; + + protected var _txt :TextInput; +} +} diff --git a/src/as/com/threerings/msoy/client/SimpleChatPanel.as b/src/as/com/threerings/msoy/client/SimpleChatPanel.as index 4e645fa1b..307c36c2d 100644 --- a/src/as/com/threerings/msoy/client/SimpleChatPanel.as +++ b/src/as/com/threerings/msoy/client/SimpleChatPanel.as @@ -1,6 +1,24 @@ package com.threerings.msoy.client { +import mx.containers.VBox; + public class SimpleChatPanel extends VBox + implements PlaceView { + public function SimpleChatPanel (ctx :MsoyContext) + { + addChild(new ChatTextArea(ctx)); + addChild(new ChatControl(ctx)); + } + + // documentation inherited from interface PlaceView + public function willEnterPlace (plobj :PlaceObject) :void + { + } + + // documentation inherited from interface PlaceView + public function didLeavePlace (plobj :PlaceObject) :void + { + } } }