mxmlc 命令行编译

来源:互联网 发布:阿里云备案产品类型 编辑:程序博客网 时间:2024/05/22 11:50

今天学习用mxmlc命令行方式编译程序,
目的1:是为了让美术不需要安装flex就可以编译程序,验证代码
目的2:解决之前那个flex项目文件和svn冲突问题,保证不需要上传项目文件的同时可以,下到代码就可以编译
第一步,首先建立一个bat批处理文件 内容写入
mxmlc src/DoucmentClass.as -load-config+=configuration.xml -output bin-debug/GameName_debug.swf -debug
pause
*mxmlc //是命令
* src/DoucmentClass.as //文档类地址(注意和bat文件的关系)
* -load-config+=configuration.xml //加载一个配置文件,由于还需要使用系统默认配置,所以用+=表示附加(注意configuration.xml文件的目录结构)
*- output bin-debug/GameName_debug.swf //输出文件目录,这个参数不写在configuration.xml是因为加了flashbulider4会报错,估计fB4配置的结构不让你动,不知道其他还有那些参数不能用
*-debug //应该可以写在配置文件里,但考虑可以写 bebug 和 release 2个版本的bat.会比较方便
第二步,建立 configuration.xml配置文件,(注意和bat中参数文件的关系)
mxmlc的参数很多.目前弄了一些基本写在里面
<flex-config>

<frames>
<!– frames.frame: 带有将被链接到帧上的类名称序列的 SWF 帧标签。–>

<frame>

<label>game</label>

<classname>game.Game</classname>

</frame>
</frames>
<compiler>
<!– compiler.accessible: 生成可访问的 SWF–>
<accessible>true</accessible>
<!– compiler.as3: 使用基于 ActionScript 3 类的对象模型可以获得更高的性能和更出色的错误报告功能。在基于类的对象模型中,大多数内置函数是作为类的固定方法执行的。–>
<as3>true</as3>
<!– compiler.es: 使用基于 ECMAScript 版本 3 原型的对象模型以允许动态重写原型属性。在基于原型的对象模型中,内置函数是作为原型对象的动态属性执行的。–>
<es>false</es>
<source-path>
<path-element>src</path-element>
</source-path>
<library-path>
<path-element>swcs</path-element>
</library-path>

<include-libraries>


<library>swcs/TestA.swc</library>

</include-libraries>
</compiler>
<!– debug-password: 要包含在可调试的 SWF 中的口令–>
<debug-password>zlonggames.com</debug-password>
<!– default-background-color: 默认背景颜色(应用程序代码可以重写该值)–>
<default-background-color>0xFFFFFF</default-background-color>
<!– default-frame-rate: 要在 SWF 中使用的默认帧频。–>
<default-frame-rate>24</default-frame-rate>
<!– default-script-limits: 默认脚本执行限制(root 属性可以重写该值)–>
<default-script-limits>
<max-recursion-depth>1000</max-recursion-depth>
<max-execution-time>60</max-execution-time>
</default-script-limits>
<!– default-size: 默认应用程序大小(应用程序中的 root 属性可以重写该值)–>
<default-size>
<width>500</width>
<height>375</height>
</default-size>
<!– target-player: 指定应用程序所针对的播放器版本。需要更高版本的功能将不会编译到应用程序中。支持的最小值是“9.0.0”。–>
<target-player>10.0.0</target-player>
<!– use-network: 切换是否将 SWF 标记为可以访问网络资源–>
<use-network>true</use-network>
<metadata>
<!– metadata.contributor: 要存储在 SWF 元数据中的参与者的名字–>
<contributor>zlonggames</contributor>
<!– metadata.creator: 要存储在 SWF 元数据中的作者的名字–>
<creator>breathxue</creator>
<!– metadata.description: 要存储在 SWF 元数据中的默认说明–>
<description>http://www.zlonggames.com</description>
<!– metadata.publisher: 要存储在 SWF 元数据中的发布人的名字–>
<publisher>spilgames</publisher>
<!– metadata.title: 要存储在 SWF 元数据中的默认标题–>
<title>gameName</title>
</metadata>
</flex-config>
有几个方式可以找到这些参数的使用
1.google
2. 用flex编译的时候 输入参数 -dump-config xxxx.xml 会将这次编译的所有参数都写到指定的xml中, 但尝试直接用这个xml作为配置文件,失败…只能考一部分出来了
3.cmd 输入 mxmlc -help为了统一,我把fB4中加的参数都放到配置文件中了,fb4的参数只有  -load-config+=configuration.xml
以后有什么需要改的就改配置文件就可以了

只在自己机器测试通过,找个美术试试去
测试成功
而且之前没有考虑的loading的问题,
<include-libraries>

<library>swcs/TestA.swc</library>

</include-libraries>
的东西应该会影响loading,后来发现没有问题..还要研究一下

 

 

 

air的使用amxmlc

air不能直接运行bin-debug下的swf,会报“VerifyError: Error #1014: 无法找到类 flash.events::NativeWindowBoundsEvent。”

所以air想要不打包air程序,直接运行要使用adl命令。

 

amxmlc src/TemplateMaker.mxml -output bin-debug/TemplateMaker.swf
adl bin-debug/TemplateMaker-app.xml

原创粉丝点击