2012-01-14 25 views
0

我有一個TextArea,我試圖使用HTTPRequest獲取網站並在TextArea中輸出html源代碼 ,但沒有任何事情發生。Flex - HTTPRequest在TextArea中輸出html源代碼

<?xml version="1.0" encoding="utf-8"?> 
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009" 
     xmlns:s="library://ns.adobe.com/flex/spark" 
     xmlns:ns1="*" 
     actionBarVisible="true" currentState="landscape" tabBarVisible="false" 
     overlayControls.landscape="false" 
     tabBarVisible.landscape="false" 
     actionBarVisible.portrait="true" viewActivate="view1_viewActivateHandler(event)"> 
    <fx:Declarations> 
     <s:HTTPService id="service" resultFormat="e4x"/> 
    </fx:Declarations> 
    <s:TextArea id="mainTextField" text="{service.lastResult}"/> 
    <fx:Script> 
     <![CDATA[ 
      import spark.events.ViewNavigatorEvent; 

      protected function view1_viewActivateHandler(event:ViewNavigatorEvent):void 
      { 
       service.url = "http://www.google.com"; 

      } 

     ]]> 
    </fx:Script> 

    <s:actionContent> 

    </s:actionContent> 
    <s:titleContent> 

    </s:titleContent> 
    </s:View> 

回答

0

您應該致電service.send()發送請求。

+0

這樣做:)謝謝。 – RapsFan1981 2012-01-14 23:36:06

+0

順便說一句,任何人有這個問題我也必須改變resultFormat =「e4x」resultFormat =「文本」 – RapsFan1981 2012-01-14 23:55:54