Newer
Older
ubChattin / src / imWindow.mxml
@reddawg reddawg on 11 Feb 2008 1 KB Sync
<?xml version="1.0" encoding="utf-8"?>
<!--
  Copyright 2008 Christopher Olsen <cwolsen@domainatlantic.com>
  
  $Id$
-->
<tvWindow xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" layout="absolute" cornerRadius="7" title="IM" width="450" height="400" borderThicknessLeft="0" borderThicknessRight="0" borderThicknessBottom="0">
  <mx:Script>
  <![CDATA[
    import mx.controls.Alert;
  
    public var toNick:String;
    public var tvMaster:Master;
  
    public function sendMsg():void {
      tvMaster.tvNetwork.sendData("MSG " + toNick + ":" + inputText.text + "\n");
  	  msgText.htmlText += "[" + tvMaster.fmtdDate() + "] " + (tvMaster.userName + ": " + inputText.htmlText);
  	  inputText.htmlText = "";
      } /* End sendMsg() */
      
    private function checkEnter(event:KeyboardEvent):void {
      if ((event.keyCode == Keyboard.ENTER) && (event.shiftKey == false))
        sendMsg();
    }

  ]]>
  </mx:Script>
  <mx:VBox width="100%" height="100%" verticalGap="0">
    <mx:TextArea click="focusManager.setFocus(inputText.textArea)" mouseUp="tvMaster.setClip(msgText)" updateComplete="msgText.verticalScrollPosition = msgText.maxVerticalScrollPosition" id="msgText" width="100%" height="100%" />
    <mx:RichTextEditor id="inputText" width="100%" keyDown="checkEnter(event)"  height="175" y="154" showControlBar="true" title="Text Input:" verticalScrollPolicy="off"  borderThicknessLeft="0" borderThicknessBottom="0" borderThicknessRight="0" cornerRadius="0"/>
  </mx:VBox>
</tvWindow>