Compilation results from Flex Builder and Flex Ant Tasks are Different
2012-04-26 16:57
239 查看
Issue
When you compile your Adobe Flash Builder project using Ant, the finished application (or library) does not work. You can compile the same project using Flash Builder without any issue.A good indication of this problem is that your compiled SWF/SWC using Ant is smaller than the one you get when compiling from Flash Builder.
Reason
This problem occurs when the configuration used with Ant is not the same as the one Flash Builder itself is using.Solution
You can determine the options that Flash Builder itself is using to compile your project by creating a configuration file. You can then use that file, including any edits you might make, to run mxmlc or compc from Ant and achieve the desired results.To generate the configuration file, you should add the following command-line option in Flash Builder:
Windows
-dump-config=c:\myconf.xml
Mac/Unix
-dump-config=/tmp/myconf.xml
You can edit your compiler arguments in Flash Builder by having your project open, going to the "Project" menu and choosing "Properties" and then "Flex Compiler". Add the option in the "Additional Compiler Arguments" box.
The file name and location can be anywhere you wish, where you have permission to create a file.
Known Issues
There are a couple of known issues with the produced config file, and you can remedy these quite easily as follows:1. The generated <manifest> tag will have a relative path. For use with Ant, you will need to edit the path to be absolute, including all directories above it like so:
<manifest>C:\FlashBuilder\Flex SDK\frameworks\mxml-manifest.xml</manifest>
2. The token œ${flexlib} will appear in the config file but should have been substituted. This is a known issue. You can either comment out the two locations where it appears, or fill in the location of your Flex lib directory.
To then run the compiler with this config file, it is simplest to copy it to the bin directory of the SDK you are using beneath your installation of Flash Builder.
Running MXMLC
You can then invoke mxmlc like this:Windows:
mxmlc -load-config+=mycfg.xml C:\\projects\\src\\main.mxml -output myswf.swf
Mac/Unix:
./mxmlc -load-config+=mycfg.xml /projects/src/main.mxml -output myswf.swf
Running COMPC
When using compc, the classes to be compiled into the SWC are not output to the generated config file. You must add them manually, or from the command line.The simplest way to accomplish this is to add tags as follows to your config file:
<include-classes> <class>analysisModule</class> <class>adminModule</class> </include-classes>
You can get the actual content for thst from your project file (.flexLibProperties) which will look something like this:
<?xml version="1.0" encoding="UTF-8"?> <flexLibProperties version="1"> <includeClasses> <classEntry path="analysisModule"/> <classEntry path="adminModule"/> </includeClasses> <includeResources/> <namespaceManifests/> </flexLibProperties>
The classEntry paths translate into the class tag values.
After doing this you can run compc like this:
Windows:
compc -load-config+=analysis_cfg.xml -output myswc.swc
Mac/Unix:
./compc -load-config+=analysis_cfg.xml -output myswc.swc
相关文章推荐
- #Paper Reading# Private traits and attributes are predictable from digital records of human behavior
- Ant and Flex 用Ant编译MXML文件 - 蚂蚁咬断松紧带(^_^)
- 解决:win10_x64 VMware Workstation and Hyper-V are not compatible. Remove the Hyper-V role from the system before running VMware Workstation
- [Ant] How the tasks are called in Ant?
- Flex Ant Tasks详解
- ORA-12537 if Listener (including SCAN Listener) and Database are Owned by Different OS User [ID 1069
- Select COUNT(*) and COUNT(column) are different things!
- String object and String literal are different
- redirect:2>&1使用&redirect and output and return value are different
- Java - "==" and "equals" are different method to String Class
- Why doesn't RecyclerView have onItemClickListener()? and How RecyclerView is different from Listview
- Designing Data Storage Architecture - SQL Azure - why use it and what makes it different from SQL se
- 使用 Flex Ant Tasks 构建 Flex 项目-第 I 部分:为 Flex 创建构建脚本
- 利用二叉树的中序遍历和后序遍历序列构造一个二叉树Search results for Construct Binary Tree from Inorder and Postorder Traversa
- How to load 3d model from different domain and display it with Three.js
- What are the different versions of JSF and when was it released?
- What Are Different Types Of Internal Tables and Their Usage
- whether the results are the same of getClass().getName() called in child class and parent class?
- gcnew and new,different from each other!
- Compound class names are not supported. Consider searching for one class name and filtering the results