IT기술/Flex

flex 31 jsp flex연동

dobbby 2008. 11. 27. 18:04
반응형



<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="show();"<--프로그램 시작시 바로 실행
 <mx:HTTPService id="httpRequest" method="post" result="result(event)" fault="fault(event)" resultFormat="text" url="http://192.168.0.139/Webtest/flex/test.jsp">
 <!-- <mx:request>
   <dan>{ns.value}</dan>
  </mx:request>-->
 </mx:HTTPService>
 <mx:Panel width="250" height="250" layout="absolute" horizontalCenter="0" verticalCenter="0">
  <mx:Label text="원하는 구구단을 선택해보세요" horizontalCenter="-30" verticalCenter="-70"/>
  <mx:NumericStepper id="ns" verticalCenter="-70" horizontalCenter="70" minimum="2" maximum="9" change="show();"/>
  <mx:Text horizontalCenter="0" verticalCenter="0" id="t" width="100" height="210" textAlign="center"/>
 </mx:Panel>
 <mx:Script>
  <![CDATA[
   import mx.controls.Alert;
   import mx.rpc.events.ResultEvent;
   import mx.rpc.events.FaultEvent;

   public function result(event:ResultEvent):void{
    t.text = event.result.toString();
   }
   public function fault(event:FaultEvent):void{
    mx.controls.Alert.show("fail");
   }
   public function show():void{
    httpRequest.request={dan:uint(ns.value)};
    httpRequest.send();

   }
  ]]>
 </mx:Script>
</mx:Application>
반응형