pageshow.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="onInit()" xmlns="*" layout="absolute" backgroundGradientColors="[#ffffff, #c0c0c0]">
<mx:Script>
<![CDATA[
public function onInit():void
{
userRequest.send();
}
]]>
</mx:Script>
<mx:Script>
<![CDATA[
import mx.controls.Alert; //引入Alert完整组件类
private function getFirstPage():void{
prepage.enabled=false;
nextpage.enabled=true;
pageno.text="1";
userRequest.send();
}
private function getPrepage():void{
if(absolutepage.text!="1"){
nextpage.enabled=true;
pageno.text=String(Number(absolutepage.text)-1);
userRequest.send();
}
else{
prepage.enabled=false;
}
}
private function getNextpage():void{
if(absolutepage.text!=totalpage.text){
prepage.enabled=true;
pageno.text=String(Number(absolutepage.text)+1);
userRequest.send();
}
else{
nextpage.enabled=false;
}
}
private function getLastpage():void{
prepage.enabled=true;
nextpage.enabled=false;
pageno.text=totalpage.text;
userRequest.send();
}
private function getpage():void{
prepage.enabled=true;
nextpage.enabled=true;
pageno.text=pageno.text;
userRequest.send();
}
private function query():void{
userRequest.send();
}
]]>
</mx:Script>
<mx:HTTPService id="userRequest" url="wubishow.php" useProxy="false" method="GET">
<mx:request xmlns="">
<page>{pageno.text}</page><character>{character.text}</character>
</mx:request>
</mx:HTTPService>
<mx:Panel x="39" y="10" width="958" height="534" layout="absolute" verticalCenter="0" horizontalCenter="0">
<mx:Label id="label1" text="请输入您要查询编码的汉字或词组:" x="221" y="6" fontSize="14" height="22"></mx:Label>
<mx:TextInput x="473" y="4" id="character" fontSize="14" fontWeight="bold" color="#FF0000"/>
<mx:Button x="663" y="8" label="查询" click="query()"/>
<mx:DataGrid fontSize="14" id="dgUserRequest" x="212" y="36" dataProvider="{userRequest.lastResult.users.user}" width="600" textAlign="center" height="359">
<mx:columns>
<mx:DataGridColumn headerText="ID" dataField="userid"/>
<mx:DataGridColumn headerText="汉字" dataField="username"/>
<mx:DataGridColumn headerText="五笔编码" dataField="emailaddress"/>
</mx:columns>
</mx:DataGrid>
<mx:Panel x="212" y="370" width="600" layout="absolute" height="114">
<mx:Button x="18" y="27" label="第一页" click="getFirstPage()"/>
<mx:Button label="上一页" click="getPrepage()" id="prepage" x="85" y="27"/>
<mx:Button x="152" y="27" label="下一页" click="getNextpage()" id="nextpage"/>
<mx:Button x="220" y="27" label="最后一页" click="getLastpage()"/>
<mx:Label x="400" y="29" text="当前第:"/>
<mx:Label id="absolutepage" text="{userRequest.lastResult.users.absolutepage}" width="38" x="438" y="29">
</mx:Label>
<mx:Label x="473" y="29" text="页" width="19"/>
<mx:Label x="493" y="29" text="共:"/>
<mx:Label id="totalpage" text="{userRequest.lastResult.users.totalpage}" width="35" x="511" y="29">
</mx:Label>
<mx:Label x="545" y="29" text="页"/>
<mx:TextInput id="pageno" text="1" width="50" x="298" y="27"/>
<mx:Button x="354" y="27" label="Go" width="41" click="getpage()"/>
</mx:Panel>
</mx:Panel>
</mx:Application>