Getting Areacode using webservice
<?xml version=”1.0″ encoding=”utf-8″?>
<mx:Application
xmlns:mx=”http://www.adobe.com/2006/mxml”
backgroundColor=”#cccccc”
layout=”vertical”
paddingBottom=”10″
paddingLeft=”10″
paddingRight=”10″
paddingTop=”10″ viewSourceURL=”srcview/index.html”>
<mx:Style>
Application {
backgroundColor: #cccccc;
backgroundGradientColors: #cccccc, #999999;
themeColor: #99ff00;
}
</mx:Style>
<mx:Script>
<![CDATA[
import mx.rpc.events.FaultEvent;
import mx.rpc.AsyncToken;
import mx.rpc.events.ResultEvent;
import mx.rpc.Responder;
[Bindable]
private var searching : Boolean = false;
private function search():void
{
searching = true;
service.GetLocationInfoForPhoneNumber.send(areaCode.text, threeDigits.text);
}
private function onResult(event:ResultEvent):void
{
searching = false;
if ( event.result.ServiceResult.Count == 0 )
{
output.text = event.result.ServiceStatus.StatusDescription;
return;
}
else
{
var info : Object = event.result.ServiceResult.PhoneNumberInfo[0];
output.text =
“Area Code:\t” + info.AreaCode + “\n” +
“Digits:\t\t” + info.FirstThreeDigits + “\n” +
“City:\t\t\t” + info.City + “\n” +
“County:\t\t” + info.County + “\n” +
“State:\t\t” + info.State + “\n” +
“Country:\t” + info.Country + “\n”;
}
}
private function onFault( event : FaultEvent ) : void
{
searching = false;
output.text = event.fault.message.toString();
}
]]>
</mx:Script>
<mx:WebService
id=”service”
result=”onResult(event)”
fault=”onFault(event)”
wsdl=”http://wslite.strikeiron.com/phonenumberinfolite01/PhoneNumberInfoLite.asmx?WSDL”/>
<mx:ApplicationControlBar
dock=”true”
verticalAlign=”middle”>
<mx:Label
text=”Area Code:”/>
<mx:TextInput
maxChars=”3″
id=”areaCode”
text=”301″/>
<mx:Label
text=”First Three Digits:”/>
<mx:TextInput
maxChars=”3″
id=”threeDigits”
text=”929″/>
<mx:Button
label=”Find!”
click=”search()”
enabled=”{ !searching }”
useHandCursor=”true”
buttonMode=”true” />
</mx:ApplicationControlBar>
<mx:ProgressBar
indeterminate=”true”
labelPlacement=”center”
visible=”{ searching }”
includeInLayout=”{ searching }”
width=”100%” />
<mx:TextArea
editable=”false”
id=”output”
width=”100%”
height=”100%” />
</mx:Application>
No comments yet.
Leave a comment
-
Recent
- Flex for the most need to know 10 things
- Using Action Script Bounce the ball
- Adobe Flex interview questions with answers
- Flex Interview Questions
- Getting image form Xml using repeater
- Tittle window using with an effect
- Mask image album
- Setting style for VScrollBar
- HorizontalList image gallery
- Add many videos in datagrid
- Using states getting columns in datagrid in runtime
- Runtime datagrid
-
Links