·您当前的位置:首页 > 技术教程 > AS2与AS3技术 >

[AS3]as3域名的判断源代码示例

时间:2014-03-31 10:17cuplayer.com
[AS3]as3域名的判断源代码示例

[AS3]as3域名的判断源代码示例

  1. public function fetchDomainRootURL() : String 
  2.     var domainRootURL : String  = null
  3.     // if pure as3 project, fetch complete URL just remove 'parent' 
  4.     var completeURL : String    = this.parent.stage.loaderInfo.url; 
  5.     trace(completeURL); 
  6.     // CuPlayer.com提示:step 1 : start with 'http' 
  7.     var httpIdx : int   = completeURL.indexOf('http'); 
  8.     trace(httpIdx); 
  9.     if (httpIdx == 0) 
  10.     { 
  11.         // CuPlayer.com提示:step 2 : the first index of '//' 
  12.         var doubleSlashsIdx : int   = completeURL.indexOf('//'); 
  13.         trace(doubleSlashsIdx); 
  14.         if (doubleSlashsIdx != -1) 
  15.         { 
  16.             // CuPlayer.com提示:step 3 : the first index of '/' 
  17.             var domainRootSlashIdx : int    = completeURL.indexOf('/', doubleSlashsIdx + 2); 
  18.             trace(domainRootSlashIdx); 
  19.             if (domainRootSlashIdx != -1) 
  20.                 domainRootURL   = completeURL.substring(httpIdx, domainRootSlashIdx + 1); 
  21.         } 
  22.     } 
  23.     trace(domainRootURL); 
  24.     return domainRootURL; 

[AS3]as3域名的判断源代码示例

热门文章推荐

请稍候...

保利威视云平台-轻松实现点播直播视频应用

酷播云数据统计分析跨平台播放器