Newer
Older
ubChattin / src / Login.mxml
@reddawg reddawg on 6 Feb 2008 2 KB Sync
<?xml version="1.0" encoding="utf-8"?>
<mx:Panel xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" layout="absolute" alpha="1.0" backgroundAlpha="1.0" cornerRadius="7" borderColor="#808080" title="Login" height="220" width="426" creationComplete="doInit()">
  <mx:Script>
  <![CDATA[
    import mx.managers.PopUpManager;
    import mx.controls.Alert;
  
    public var funcs:Object;
    [Bindable]
    public var tvMaster:Master;
    
    private function doInit():void {
      var i:Number = 0;

      if (tvMaster.chanSpec != null) {
      	if (tvMaster.chanSpec.indexOf("#") != 0x0)
      	  tvMaster.chanSpec = "#" + tvMaster.chanSpec;
      	  
      	for (i = 0;i < tvMaster.chanList.length;i++) {
      	  if (tvMaster.chanList[i].channel.toLowerCase() == tvMaster.chanSpec.toLowerCase()) {
      	  	selChan.selectedIndex = i;
      	  	selChan.enabled = false;
      	  	break;
      	    }
      	  }
        }
      }
    
    public function doAuth():void {
      if ((username.text.length > 0) && (tvMaster.validateNick(username.text) == true))  {
      	loginButton.enabled = false;
      	tvMaster.masterObject.selChan.selectedIndex = selChan.selectedIndex;
        funcs.authUser(username.text,selChan.selectedItem.channel);
        }
      else
        Alert.show("Please enter a valid nick before continuing.");
      }
  ]]>
  </mx:Script>
  
  <mx:Label id="logErr"  x="232" width="160" y="10"/>
  <mx:Label text="Channel:"  x="168" y="78"/>
  <mx:ComboBox id="selChan" width="123" dataProvider="{tvMaster.chanList}" labelField="channel"  x="232" y="76"/>
  <mx:Image width="160" height="140" source="http://www.ubixonline.com/UbixCube.swf" autoLoad="true" y="0"/>
  <mx:Label text="*"  x="160" y="42" width="10" fontSize="10" color="#ff0000"/>
  <mx:Label text="Nick:"  x="168" y="42"/>
  <mx:TextInput id="username"  text="" x="232" y="40"/>
  <mx:TextArea x="168" y="104" height="40" width="228" text="Nick is the name which you want to be known by." wordWrap="true" editable="false" borderThickness="0"/>
  <mx:ControlBar horizontalAlign="right" x="0" y="114">
  <mx:Button id="loginButton" label="Login" click="doAuth()" />
  </mx:ControlBar>
</mx:Panel>