获取Flash当前所在域主域名
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);// step 1 : start with 'http'var httpIdx : int= completeURL.indexOf('http');trace(httpIdx);if (httpIdx == 0){// step 2 : the first index of '//'var doubleSlashsIdx : int= completeURL.indexOf('//');trace(doubleSlashsIdx);if (doubleSlashsIdx != -1){// 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;}
?