Flex导出的swf运行报 Error #2148
private function getAbsPath():void{ var swfPath:String = this.parent.stage.loaderInfo.url;//获取当前swf的路径var swfPathArray:Array = swfPath.split("/"); if (swfPathArray[0] == "file:") { //本地路径if(swfPathArray.length<=3){ currSwfUrl = swfPathArray[2]; currSwfUrl = currSwfUrl.substring(0,currSwfUrl.lastIndexOf(currSwfUrl.charAt(2))); }else{ currSwfUrl = swfPath; currSwfUrl = currSwfUrl.substring(0,currSwfUrl.lastIndexOf("/")); } }else{ //网络路径currSwfUrl = swfPath; currSwfUrl = currSwfUrl.substring(0,currSwfUrl.lastIndexOf("/")); } currSwfUrl += "/"; }
?
回归正题,在不断google、不断测试,不断失望后,突然找到国外的一篇帖子,以下是原文:
写道Error #2148 is a very strange error that I get when I load xml files from the local machine. It’s strange because I only get it with Flex 3 and I don’t get the error all the time when I load xml files.?
意思很明显了,就是你编译的应用,如果是使用了本地运行方式,不需要使用外部的访问,那在编译的时候需要加上编译参数:
-use-network=false
具体操作就是"?Project -> Properties -> Flex Compiler and add -use-network=false to Additional compiler arguments"
加入后,编译,再导出,测试,ok,问题解决!
?
?