box-o-sand/PracticingFlex/02-shipping/PlainText.mxml

48 lines
1.2 KiB
Plaintext
Raw Normal View History

<mx:Application name=""
xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute"
backgroundColor="#FFFFFF"
backgroundImage="">
<mx:Script>
<![CDATA[
import mx.rpc.events.ResultEvent;
import mx.rpc.events.FaultEvent;
import mx.controls.Alert;
private function handlePlain(event:ResultEvent):void
{
shippingOptions.htmlText = event.result.toString();
}
private function handleFault(event:FaultEvent):void
{
Alert.show(event.fault.faultString, "Error");
}
]]>
</mx:Script>
<mx:HTTPService id="plainRPC" url="http://10.10.231.98:18080/text"
result="handlePlain(event)"
fault="handleFault(event)"
resultFormat="text">
<mx:request xmlns="">
<zipcode>{zipcode.text}</zipcode>
<pounds>{weight_lb.text}</pounds>
</mx:request>
</mx:HTTPService>
<mx:Label x="54" y="25" text="Zip Code"/>
<mx:Label x="65" y="51" text="Weight"/>
<mx:TextInput x="128" y="23" id="zipcode"/>
<mx:TextInput x="128" y="49" id="weight_lb"/>
<mx:Button x="128" y="79" label="Get Shipping Options"
click="plainRPC.send();" />
<mx:TextArea x="339" y="24" width="198" height="77" id="shippingOptions"/>
</mx:Application>