2016-10-13 00:16:48 点击量:5 标签: 收藏本文
AS3]as3获取一个字符串地址中的域名
- public function fetchDomainRootURL() : String
- {
- var domainRootURL : String = null;
- // if pure as3 project, fetch complete URL just remove 'parent'
- var completeURL : String = this.parent.stage.loaderInfo.url;
- trace(completeURL);
- // cuplayer.com: step 1 : start with 'http'
- var httpIdx : int = completeURL.indexOf('http');
- trace(httpIdx);
- if (httpIdx == 0)
- {
- // cuplayer.com: step 2 : the first index of '//'
- var doubleSlashsIdx : int = completeURL.indexOf('//');
- trace(doubleSlashsIdx);
- if (doubleSlashsIdx != -1)
- {
- // cuplayer.com:step 3 : the first index of '/'
- var domainRootSlashIdx : int = completeURL.indexOf('/', doubleSlashsIdx + 2);
- trace(domainRootSlashIdx);
- if (domainRootSlashIdx != -1)
- domainRootURL = completeURL.substring(httpIdx, domainRootSlashIdx + 1);
- }
- }
- trace(domainRootURL);
- return domainRootURL;
- }
我们是一家提供综合软件外包与弱电工程服务的技术公司。
业务涵盖定制软件、管理系统、网站、小程序、APP、系统集成、网络布线、监控安防、门禁、机房建设及长期技术维护。
公司地址:湖北省宜昌市伍家岗区东站二路6号三峡(宜昌)大数据产业园海洋馆二楼A203室