특별한녀석 2008. 12. 27. 01:36
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
 <mx:Script>
  <![CDATA[
   import mx.rpc.events.FaultEvent;
   import mx.rpc.events.ResultEvent;
   
   private function onClick() : void
   {
    getData.send();
   }
   
   private function onResult(event : ResultEvent) : void
   {
    txtResult.text = event.result.toString();
   }
   
   private function onFault(event : FaultEvent) : void
   {
    txtResult.text = event.fault.toString();
   }
  ]]>
 </mx:Script>
 <mx:HTTPService id="getData" url="http://www.google.co.kr/" result="onResult(event);" fault="onFault(event);" resultFormat="text" />
 <mx:Button x="10" y="10" label="send" click="onClick();" id="btnSend" />
 <mx:TextArea x="10" y="40" width="344" height="226" id="txtResult" />
</mx:Application>