今天在FB4上将最近做的一个demo导出为swf文件运行,很奇怪的是在FB中随便怎么改运行都没有问题,一开始怀疑是路径问题,后来也改成了绝对路径方式,但是导出后仍然不能正常运行。
当然这一系列过程中也不是一无所获:
1、FB中编译的一般都在bin-debug中调试运行,如何导出为web应用能使用的呢,可以参考FB的帮助说明。
- 首先,在项目”属性—构建路径“中 选择“合并到代码中“,这样你所引用的swc文件就可以包含到你的代码中了。
- 选择项目,右键,在”导出“中选择”发行版本“,然后选择你要导出的应用模块,导出后,工程下会生成一个bin-release的文件夹
- 拷贝这个文件到你的web目录下,运行
2、如何获取当前swf文件运行的绝对路径?
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.
[RPC Fault faultString=”Error #2148: SWF file file:///D:/_path_to_file_/Main.swf cannot access local resource assets/xml/config.xml. Only local-with-filesystem and trusted local SWF files may access local resources.” faultCode=”InvokeFailed” faultDetail=”null”
So the quick fix is to add this arguments to the compiler:
-use-network=false
Go to Project -> Properties -> Flex Compiler and add -use-network=false to Additional compiler arguments
If you got the #2148 Error in a different situation let me know and I will post you comments/solutions.
[RPC Fault faultString=”Error #2148: SWF file file:///D:/_path_to_file_/Main.swf cannot access local resource assets/xml/config.xml. Only local-with-filesystem and trusted local SWF files may access local resources.” faultCode=”InvokeFailed” faultDetail=”null”
So the quick fix is to add this arguments to the compiler:
-use-network=false
Go to Project -> Properties -> Flex Compiler and add -use-network=false to Additional compiler arguments
If you got the #2148 Error in a different situation let me know and I will post you comments/solutions.
意思很明显了,就是你编译的应用,如果是使用了本地运行方式,不需要使用外部的访问,那在编译的时候需要加上编译参数:
-use-network=false
具体操作就是" Project -> Properties -> Flex Compiler and add -use-network=false to Additional compiler arguments"
加入后,编译,再导出,测试,ok,问题解决!
相关推荐
AdvancedDataGrid导出复杂表头excel
网上的方法很多,我看了好多,但是就是不管用,我的情况是,在程序没发布时,直接运行没错误,但是当发布时,访问就错了,提示SecurityError: Error #2048: 安全沙箱冲突:http://localhost:8086/index.swf 不能从 ...
Flex中SWF和其他SWF文件之间的通信原理。该案例中TestLocalConnection为主SWF文件加载了TestLocalConnectionReceiver.SWF,两者之间是在同一个域下的通信,工程代码编译路径需要下载者手动修改下。其他技术细节参见...
flex导出csv文件。可以实现flex表格里面的内容导成csv文件
一个简单Flex控制SWF播放的范例。 内含一个Flash源码。 Import到Flex Builder就可以了
这里讲述的是在Flex Application中嵌套一个SWF,然后实现Flex与SWF相互间的通讯。我们需要引入SystemManager接口实现。 环境:Eclipse + Flex Builder
Flex中加载SWF方法,介绍了flex 对 swf 加载和处理
Flex导出Excel 详解,该压缩文件有4个核心文件,可以生成任何Excel文件
<![CDATA[ import mx.controls.CheckBox; import mx.controls.Alert;... 导出" click="onCreate()"/> (data as Object)} " /> </mx:DataGridColumn> </mx:WindowedApplication>
flex加载swf的N种方法.zip
flex air 导出excel表格(这个不支持中文)。。。。。。
flex中dataGrid导出数据到excel中,不存在乱码问题
Flex利用JSP导出Excel Flex利用JSP导出Excel
SWF之间通信、Flex与SWF之间通信、C#与SWF之间通信
使用as3xls-1.0.1.SWC包做的Flex界面DateGrid数据导出Excel表格。
一个简单的flex加载外部swf文件并对其进行操作的源码程序
1、使用flex导出excel的简单实例 其中使用到flex dataGrid的全选操作
FLEX导出EXCEL支持合并隐藏单元格
flex air 导出 excel 支持中文
flex导出成excel部分代码