<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" xmlns:service="services.service.*" xmlns:xluo="services.xluo.*" viewSourceURL="srcview/index.html">
<s:layout>
<s:BasicLayout/>
</s:layout>
<fx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.events.FlexEvent;
protected function btnLogin_clickHandler(event:MouseEvent):void
{
var uname=this.txtUserName.text;
var upwd=this.txtUserPwd.text;
this.login(uname,upwd);
}
protected function btnJiSuan_clickHandler(event:MouseEvent):void
{
var jieguo;
var num1=this.txtnum1.text;
var num2=this.txtnum2.text;
if(this.rdojia.selected==true)
{
jieguo=Number(num1)+Number(num2);
}
else if(this.rdojian.selected==true)
{
jieguo=Number(num1)-Number(num2);
}
else if(this.rdocheng.selected==true)
{
jieguo=Number(num1)*Number(num2);
}
else if(this.rdochu.selected==true)
{
jieguo=Number(num1)/Number(num2);
}
else
{
this.lbljieguo.text="无法计算";
}
this.lbljieguo.text="计算结果:"+jieguo;
}
protected function btnReset_clickHandler(event:MouseEvent):void
{
this.txtnum1.text="";
this.txtnum2.text="";
this.rdojia.selected=false;
this.rdojian.selected=false;
this.rdocheng.selected=false;
this.rdochu.selected=false;
this.lbljieguo.text="计算结果:无";
}
protected function login(uname:String, upwd:String):void
{
}
protected function btnAdd_clickHandler(event:MouseEvent):void
{
addResult2.token = xluo.add(this.txtTitle.text,this.txtContent.text);
showResult2.token = xluo.show();
showListResult.token = xluo.showList();
}
public function clear():void
{
this.txtTitle.text="";
this.txtContent.text="";
this.lblTS.text="";
}
protected function btnClear_clickHandler(event:MouseEvent):void
{
clear();
}
protected function list_creationCompleteHandler(event:FlexEvent):void
{
showResult.token = xluo.show();
showResult2.token = xluo.show();
}
protected function btnshow_clickHandler(event:MouseEvent):void
{
this.list.visible=true;
}
protected function btnyc_clickHandler(event:MouseEvent):void
{
this.list.visible=false;
}
protected function gvguestbook_creationCompleteHandler(event:FlexEvent):void
{
showListResult.token = xluo.showList();
}
protected function btnAlert_clickHandler(event:MouseEvent):void
{
Alert.show("请输入用户名","提示",Alert.OK,null);
}
]]>
</fx:Script>
<fx:Declarations>
<s:CallResponder id="loginResult"/>
<s:CallResponder id="addResult"/>
<xluo:Xluo id="xluo" fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)" showBusyCursor="true"/>
<s:CallResponder id="showResult"/>
<s:CallResponder id="showResult2"/>
<s:CallResponder id="showListResult"/>
<s:CallResponder id="addResult2"/>
</fx:Declarations>
<s:Label x="31" y="28" text="用户名:" height="14" width="50" id="lblUserName"/>
<s:Label x="38" y="59" text="密码:" width="36" height="13" id="lblUserPwd"/>
<s:TextInput x="82" y="23" id="txtUserName"/>
<s:TextInput x="82" y="53" id="txtUserPwd"/>
<s:Button x="85" y="91" label="登录" width="52" height="20" id="btnLogin" click="btnLogin_clickHandler(event)"/>
<s:Button x="150" y="91" label="重置" width="52" height="20" id="btnReset"/>
<s:Label x="4" y="141" width="297" height="46" id="lblSystem"/>
<s:Group x="309" y="24" width="275" height="196" id="groJiSuanQi">
<s:Label x="105" y="10" text="计算器" width="40" height="14"/>
<s:Label x="6" y="33" text="请输入第一个数:" id="lblnum1"/>
<s:Label x="6" y="63" text="请输入第二个数:" id="lblnum2"/>
<s:Label x="6" y="95" text="请选择运算符号:" id="lblfuhao"/>
<s:TextInput x="105" y="29" width="153" id="txtnum1"/>
<s:TextInput x="105" y="58" width="153" id="txtnum2"/>
<s:RadioButton x="110" y="88" label="加" id="rdojia"/>
<s:RadioButton x="152" y="88" label="减" id="rdojian"/>
<s:RadioButton x="190" y="88" label="乘" id="rdocheng"/>
<s:RadioButton x="228" y="88" label="除" id="rdochu"/>
<s:Button x="104" y="123" label="计算" id="btnJiSuan" click="btnJiSuan_clickHandler(event)"/>
<s:Button x="182" y="123" label="重置" id="btnResets" click="btnReset_clickHandler(event)"/>
<s:Label x="104" y="163" text="结算结果:无" width="148" height="19" id="lbljieguo"/>
</s:Group>
<s:Label x="66" y="120" text="{loginResult.lastResult}" id="label2"/>
<s:Label x="10" y="252" text="标题:"/>
<s:Label x="11" y="277" text="内容:" height="14"/>
<s:Label x="89" y="226" text="留言板"/>
<s:TextInput x="54" y="246" width="247" id="txtTitle"/>
<s:TextArea x="55" y="276" width="246" height="58" id="txtContent"/>
<s:Button x="59" y="351" label="留言" id="btnAdd" click="btnAdd_clickHandler(event)"/>
<s:Button x="148" y="351" label="重写" id="btnClear" click="btnClear_clickHandler(event)"/>
<s:Label x="228" y="357" height="12" width="57" color="#F80B0B" id="lblTS"/>
<s:List x="309" y="228" width="275" id="list" creationComplete="list_creationCompleteHandler(event)">
<s:AsyncListView list="{showResult2.lastResult}"/>
</s:List>
<s:Button x="150" y="198" label="显示" id="btnshow" click="btnshow_clickHandler(event)"/>
<s:Button x="228" y="198" label="隐藏" id="btnyc" click="btnyc_clickHandler(event)"/>
<mx:DataGrid x="592" y="176" id="gvguestbook" creationComplete="gvguestbook_creationCompleteHandler(event)" dataProvider="{showListResult.lastResult}" width="326">
<mx:columns>
<mx:DataGridColumn headerText="编号" dataField="0"/>
<mx:DataGridColumn headerText="标题" dataField="1"/>
<mx:DataGridColumn headerText="时间" dataField="3"/>
<mx:DataGridColumn headerText="操作"/>
</mx:columns>
</mx:DataGrid>
<s:Button x="471" y="381" label="Alert" id="btnAlert" click="btnAlert_clickHandler(event)"/>
</s:Application>