[FLEX] HTTPService를 사용하여 파라미터 전송하기
개발/FLEX & AIR2009. 10. 25. 18:26
HTTPService를 사용하여 파라미터를 전송하는 경우이다.
어떤 값을 요청하여 거기에 해당 하는 값을 받아와서 뿌려준다.
실패했을 경우와 성공했을경우 evnet를 사용하여 해당 메세지를 보여준다.
어떤 값을 요청하여 거기에 해당 하는 값을 받아와서 뿌려준다.
실패했을 경우와 성공했을경우 evnet를 사용하여 해당 메세지를 보여준다.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
<![CDATA[
import mx.utils.ObjectUtil;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import mx.controls.Alert;
public function faultHandler(event:FaultEvent):void{
Alert.show(ObjectUtil.toString(event));
}
public function resultHandler(event:ResultEvent):void{
Alert.show(ObjectUtil.toString(event));
}
]]>
</mx:Script>
<mx:HTTPService id="freeRequest"
url="http://www.anaconda.pe.kr/test.jsp"
fault="faultHandler(event)"
result="resultHandler(event)"
useProxy="false">
<mx:request xmlns="">
<id>{cd.selectedItem}</id>
</mx:request>
</mx:HTTPService>
<mx:Panel title="example"
height="100%" width="90%"
paddingBottom="10" paddingLeft="10" paddingRight="10" paddingTop="10"
layout="vertical">
<mx:DataGrid id="dbPosts"
dataProvider="{freeRequest.lastResult.result_set.record}"
width="100%"/>
<mx:ControlBar horizontalAlign="center">
<mx:Label text="ID 선택" />
<mx:ComboBox id="cd" change="freeRequest.send();">
<mx:ArrayCollection>
<mx:String>0</mx:String>
<mx:String>1</mx:String>
<mx:String>2</mx:String>
<mx:String>3</mx:String>
<mx:String>4</mx:String>
<mx:String>5</mx:String>
</mx:ArrayCollection>
</mx:ComboBox>
</mx:ControlBar>
</mx:Panel>
</mx:Application>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
<![CDATA[
import mx.utils.ObjectUtil;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import mx.controls.Alert;
public function faultHandler(event:FaultEvent):void{
Alert.show(ObjectUtil.toString(event));
}
public function resultHandler(event:ResultEvent):void{
Alert.show(ObjectUtil.toString(event));
}
]]>
</mx:Script>
<mx:HTTPService id="freeRequest"
url="http://www.anaconda.pe.kr/test.jsp"
fault="faultHandler(event)"
result="resultHandler(event)"
useProxy="false">
<mx:request xmlns="">
<id>{cd.selectedItem}</id>
</mx:request>
</mx:HTTPService>
<mx:Panel title="example"
height="100%" width="90%"
paddingBottom="10" paddingLeft="10" paddingRight="10" paddingTop="10"
layout="vertical">
<mx:DataGrid id="dbPosts"
dataProvider="{freeRequest.lastResult.result_set.record}"
width="100%"/>
<mx:ControlBar horizontalAlign="center">
<mx:Label text="ID 선택" />
<mx:ComboBox id="cd" change="freeRequest.send();">
<mx:ArrayCollection>
<mx:String>0</mx:String>
<mx:String>1</mx:String>
<mx:String>2</mx:String>
<mx:String>3</mx:String>
<mx:String>4</mx:String>
<mx:String>5</mx:String>
</mx:ArrayCollection>
</mx:ComboBox>
</mx:ControlBar>
</mx:Panel>
</mx:Application>
'개발 > FLEX & AIR' 카테고리의 다른 글
[Flex] PieChart (0) | 2009.11.24 |
---|---|
[Flex] LineChart (0) | 2009.11.24 |
[Chart] ColumnChart, BarChart (0) | 2009.11.24 |
[FLEX] HTTPService 서비스 사용하기 - 데이터그리드 결과값 바인딩 (0) | 2009.10.25 |
crossdomain.xml (0) | 2009.10.25 |