mainl.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init();">
<mx:Script>
<![CDATA[
import mx.rpc.events.ResultEvent;
import mx.controls.Alert;
[Bindable]
private function init():void{
flash.system.System.useCodePage=true;
getBeauty();
}
private function getBeauty():void{
hsGetBeauty.send();
}
public function delBeauty():void{
var delId:Object = new Object;
delId.id = dgBeauty.selectedItem.id;
hsDelBeauty.send(delId);
}
private function delResult(event:ResultEvent):void{
Alert.show( "Result "+String(event.result) );
getBeauty();
}
]]>
</mx:Script>
<mx:Style source="beauty.css"/>
<mx:HTTPService id="hsGetBeauty" url="http://localhost/beauty/php/getbeauty.php"/>
<mx:HTTPService id="hsDelBeauty" url="http://localhost/beauty/php/delbeauty.php" method="GET" result="delResult(event)"/>
<mxataGrid styleName="dgBeauty" id="dgBeauty" x="48" y="29" width="646" height="207" dataProvider="{hsGetBeauty.lastResult.beauties.beauty}">
<mx:columns>
<mxataGridColumn headerText="ID" dataField="id"/>
<mxataGridColumn headerText="姓名" dataField="name"/>
<mx:DataGridColumn headerText="年龄" dataField="age"/>
<mx:DataGridColumn headerText="婚否" dataField="marry"/>
<mx:DataGridColumn headerText="出生日期" dataField="birth"/>
<mx:DataGridColumn headerText="删除" width="60">
<mx:itemRenderer>
<mx:Component>
<mx:Button label="删除" click="outerDocument.delBeauty()"/>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
</mx:columns>
</mx:DataGrid>
</mx:Application>
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init();">
<mx:Script>
<![CDATA[
import mx.rpc.events.ResultEvent;
import mx.controls.Alert;
[Bindable]
private function init():void{
flash.system.System.useCodePage=true;
getBeauty();
}
private function getBeauty():void{
hsGetBeauty.send();
}
public function delBeauty():void{
var delId:Object = new Object;
delId.id = dgBeauty.selectedItem.id;
hsDelBeauty.send(delId);
}
private function delResult(event:ResultEvent):void{
Alert.show( "Result "+String(event.result) );
getBeauty();
}
]]>
</mx:Script>
<mx:Style source="beauty.css"/>
<mx:HTTPService id="hsGetBeauty" url="http://localhost/beauty/php/getbeauty.php"/>
<mx:HTTPService id="hsDelBeauty" url="http://localhost/beauty/php/delbeauty.php" method="GET" result="delResult(event)"/>
<mxataGrid styleName="dgBeauty" id="dgBeauty" x="48" y="29" width="646" height="207" dataProvider="{hsGetBeauty.lastResult.beauties.beauty}">
<mx:columns>
<mxataGridColumn headerText="ID" dataField="id"/>
<mxataGridColumn headerText="姓名" dataField="name"/>
<mx:DataGridColumn headerText="年龄" dataField="age"/>
<mx:DataGridColumn headerText="婚否" dataField="marry"/>
<mx:DataGridColumn headerText="出生日期" dataField="birth"/>
<mx:DataGridColumn headerText="删除" width="60">
<mx:itemRenderer>
<mx:Component>
<mx:Button label="删除" click="outerDocument.delBeauty()"/>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
</mx:columns>
</mx:DataGrid>
</mx:Application>