MACROMEDIA FLEX-GETTING STARTED WITH FLEX Uživatelský manuál Strana 89

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 148
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 88
<![CDATA[
import mx.rpc.events.ResultEvent;
import mx.rpc.events.FaultEvent;
import mx.controls.Alert;
public function handlePlain(event:ResultEvent):void {
shippingOptions.htmlText = event.result.toString();
}
public function handleFault(event:FaultEvent):void {
Alert.show(event.fault.faultString, "Error");
}
]]>
</mx:Script>
<mx:HTTPService result="handlePlain(event);"
fault="handleFault(event);"
id="plainRPC" resultFormat="text"
url="http://examples.adobe.com/flex3/exchangingdata/text
/plainHttpService.php"
useProxy="false">
<mx:request xmlns="">
<zipcode>{zipcode.text}</zipcode>
<pounds>{weight_lb.text}</pounds>
</mx:request>
</mx:HTTPService>
<mx:Label x="56" y="32" text="Zip Code" width="55"
height="18"
textAlign="right" fontWeight="bold"/>
<mx:Label x="56" y="58" text="Weight" width="55" height="18"
textAlign="right" fontWeight="bold"/>
<mx:TextInput x="130" y="32" id="zipcode" width="160"
height="22"/>
<mx:TextInput x="130" y="58" id="weight_lb" width="160"
height="22"/>
<mx:Button x="130" y="95" label="Get Shipping Options"
click="plainRPC.send();" width="160" height="22"/>
<mx:Text x="56" y="150" id="shippingOptions" width="310"
height="133"
fontWeight="bold"/>
</mx:Application>
The second version of the application, which handles parsing
the XML using ActionScript 3’s E4X syntax, appears in Exam-
ple 5-4.
Using the HTTPService Tag | 73
Zobrazit stránku 88
1 2 ... 84 85 86 87 88 89 90 91 92 93 94 ... 147 148

Komentáře k této Příručce

Žádné komentáře