flex 查查你的号码归属地

本文介绍了一个使用Adobe MXML创建的手机归属地查询应用,包括应用架构、数据交互及查询结果显示。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="480" height="320">
<mx:WebService id="mobileWS" wsdl="http://www.webxml.com.cn/WebServices/MobileCodeWS.asmx?wsdl"
showBusyCursor="true" result="handleMobileCode(event)" fault="handleFault(event)"/>
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import mx.controls.Alert;

[Bindable]
private var arrMobile:ArrayCollection = new ArrayCollection();

private function searchMobile(event:MouseEvent):void{
btnSearch.enabled = false;
mobileWS.getMobileCodeInfo(tiMobile.text);
}
private function handleMobileCode(event:ResultEvent):void{
//trace(event.result);
btnSearch.enabled = true;
var str:String = String(event.result);
switch(str){
case "没有此号码记录":
Alert.show("没有此号码记录");
return;
break;
case "手机号码错误 http://www.webxml.com.cn":
Alert.show("手机号码错误");
return;
break;
}
var arr:Array = str.split(":");
var arr1:Array = arr[1].split(" ");
var len:uint = arr1.length;
if(arrMobile.length>0)
{
arrMobile = new ArrayCollection();
}
for(var i:uint = 0; i < len; i++){
arrMobile.addItem(arr1[i]);
}
}
private function handleFault(event:FaultEvent):void{
Alert.show("出现网络,请确保您的网络正常");
}
]]>
</mx:Script>
<mx:Panel id="panContainer" title="手机号码归属地查询" width="480" height="320" cornerRadius="4">
<mx:Label x="72" y="57" text="请输入手机号码:"/>
<mx:Button id="btnSearch" x="343" y="52" label="查询" click="searchMobile(event)"/>
<mx:TextInput id="tiMobile" x="184" y="51" enter="searchMobile(null)"/>
<mx:Label x="143" y="117" text="省份:"/>
<mx:TextInput id="tiProvince" text="{arrMobile.getItemAt(0)}" x="186" y="110" editable="false"/>
<mx:Label x="142" y="154" text="城市:"/>
<mx:TextInput id="tiCity" text="{arrMobile.getItemAt(1)}" x="186" y="148" editable="false"/>
<mx:Label x="142" y="190" text="类型:"/>
<mx:TextInput id="tiType" text="{arrMobile.getItemAt(2)}" x="186" y="184" editable="false"/>
</mx:Panel>
</mx:Application>


来源于:http://www.as3hope.com/read.php?60
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值