2016-10-13 00:16:48 点击量:10 标签: 收藏本文
写了一个类,用于检测swf是否存在于我们希望的网站中。
提供两个方法:
detectUrl(allow_url:String, is_unload:Boolean):Boolean
detectUrl 接受两个参数,第一个字符串参数为要检测的域名,域名不要带“http://”,如果处于此域名中,返回true,否则返回false。第二个布尔参数为是否则在返回ture时载影片。
detectUrlInTxt(txt_url:String, is_unload:Boolean):Void
detectUrlInTxt 接受两个参数,第一个字符串参数为包含要检测域名的txt文本文件,如果处于此域名中,调用onResult处理器,并传入值true,否则传入 false。如果载入txt文件失败,传入值null。第二个参数作用同detectUrl。txt文件中域名定义的格式 为:&allowUrl=www.abc.com&
- class Domain extends String{
- private var txtLV:LoadVars;
- private var isUnLoad:Boolean;
- public var onResult;
- function Domain(Void){};
- public function detectUrl(allow_url:String, is_unload:Boolean):Boolean{
- var theDomain = _root._url;
- if((theDomain.indexOf(allow_url) != -1) && (theDomain.indexOf("http://") == 0)){
- return true;
- }else{
- isUnLoad = is_unload;
- if(isUnLoad){
- _root.unloadMovie();
- }
- return false;
- }
- }
- public function detectUrlInTxt(txt_url:String, is_unload:Boolean):Void{
- var owner = this;
- owner.isUnLoad = is_unload;
- txtLV = new LoadVars();
- txtLV.load(txt_url);
- txtLV.onLoad = function(success:Boolean){
- if(success){
- owner.onResult(owner.detectUrl(this.allowUrl));
- } else {
- owner.onResult(null);
- if(owner.isUnLoad){
- _root.unloadMovie();
- }
- }
- }
- }
- }
我们是一家提供综合软件外包与弱电工程服务的技术公司。
业务涵盖定制软件、管理系统、网站、小程序、APP、系统集成、网络布线、监控安防、门禁、机房建设及长期技术维护。
公司地址:湖北省宜昌市伍家岗区东站二路6号三峡(宜昌)大数据产业园海洋馆二楼A203室