解决办法:chrome在服务器上运行才会获取到值,在本地打开会报安全沙箱异常(Error #2060)
1 private function getParameter(name:String):String{ 2 if (ExternalInterface.available) { 3 try{ 4 var query:String = ExternalInterface.call("window.location.search.substring", 1); 5 var pairs:Array = query.split("&"); 6 for(var i:uint=0; i < pairs.length; i++) { 7 var pos:int = pairs[i].indexOf("="); 8 if(pos != -1) { 9 var pname:String = pairs[i].substring(0, pos); 10 if(pname == name){ 11 var value:String = pairs[i].substring(pos+1);13 return value; 14 } 15 } 16 } 17 }catch (error:Error) { 18 Alert.show("An Error occurred: " + error.message + "\n"); 19 } 20 } 21 return null; 22 }
时间: 2024-10-08 10:14:04