Flex编译器

来源:互联网 发布:淘宝跑步鞋 编辑:程序博客网 时间:2024/05/28 05:14

转自: 隐竹的专栏 http://blog.csdn.net/jomoonrain2/article/details/7275154

 

===============================================================================

来源:http://livedocs.adobe.com/flex/3/html/help.html?content=compilers_01.html

关于flex编译器

flex包含下面的两种编译器:Application编译器和component编译器

  • application编译器:该编译器将mxml ,actionscript 以及其他的一些资源文件如images ,swf和swc编译成swf文件。
  • component编译器:改编译器将如上的一些文件编译成swc。之后application编译器利用编译好的swc文件作为component库,themes或者RSLs。
启动application编译器有如下的几种启动方式:mxmlc命令行工具,flex builder构建工程选项,或者 run-time web-tier编译器。而component编译器的启动则可以通过flex builder的库工程构建选项或者是compc命令行工具。

关于application编译器

application编译器用来生成在flashplayer客户端或者air上运行的swf文件。客户端可以是独立的flashplayer也可以是浏览器中的插件flashplayer,比如IE下的ActiveX控件和Netscape-based的plug-in。

Flex builder 工程编译器。Flex builder 工程编译器有flex工程或者actionscript工程。(component编译器用在库项目中。)在功能上它同mxmlc命令行工具相似,尽管设置编译选项的途径不一样。

The mxmlc 命令行编译器。通过命令行可以启动mxmlc编译器。典型地,你将应用的根mxml文件的名字作为参数传递给编译器。输出为swf文件。

Web-tier 编译器。The Flex module for Apache and IIS compiler provides web-tier compilation of MXML files on Apache and IIS web servers. 这是你可以快速的编译测试和部署一个应用,而不是讲你的mxml文件编译成swf然后将它同包装器文件一起部署的web服务器上,你只需在浏览器中刷新刷新你的mxml文件。


Flex builder编译器和mxmlc编译器拥有相似的选项设置。参见“关于application编译器选项”

你可以用flex builder编译器 和mxmlc编译器编译纯as的应用。但是web-tier编译器必须有一个根mxml应用文件。

使用flex builder application编译器

You use the Flex Builder application compiler to create SWF files from MXML, ActionScript, and other source files. You use this compiler to precompile SWF files that you deploy later, or you can deploy them immediately to a server running the Flex web application.

To open the Flex Builder application compiler, you select Project > Build. The Flex Builder application compiler is opened by Flex Builder for Flex Projects and ActionScript Projects. (You use the component compiler for Library Projects.)

To edit the compiler settings, use the settings on the Project > Properties > Flex Compiler dialog box. For information on the compiler options, see About the application compiler options.

flex编译器拥有和mxmlc编译器同样的编译选项。有些是通过Flex编译器的对话框GUI控件来实现。To set the source path and library options, select Project > Properties > Flex Build Path and use the Flex Build Path dialog box.

你可以用同命令行相同的语法来设置flex builder的附加编译选项。For information about the syntax for setting options in the Flex Compiler dialog box, see About the command-line compilers. 

默认情况下,flex builder将编译选项暴露在工程属性上。如果你想利用配置文件,你可以自己create一个并把它通过load-config选项作为参数传递给编译器。

除了会生成swf文件以外flex builder编译器也会生成html包装器文件。html文件包括<object>和<embed> 标签用来引用swf文件,以及一些用来支持历史管理和播放器版本检测。For more information about the HTML wrapper, see Creating a Wrapper.

默认情况下,flex builder application编译器uses incremental compilation。For more information on incremental compilation, see About incremental compilation.

使用mxmlc application编译器

You use the mxmlc command-line compiler to create SWF files from MXML, AS, and other source files. You can open it as a shell script and executable file for use on Windows and UNIX systems. You use this compiler to precompile Flex applications that you deploy later. 

命令行编译器同flex sdk 安装在一起。It is in the flex_install_dir/bin directory in Flex SDK. The compiler is also included in the default Flex Builder installation, in theflex_builder_install_dir/sdks/sdk_version/bin directory.

在使用mxmlc工具之前你应该先明白他的语法以及如何利用配置文件。For more information, see About the command-line compilers.

基本语法如下:mxmlc [options] target_file

默认选项是需要编译成swf的目标文件,and it is required to have a value.如果你用了空格分隔的列表做为选项的一部分,那么你可以在add  目标文件之前用双横线(--)来结束这个列表。例如:mxmlc -option arg1 arg2 arg3 -- target_file.mxml

To see a list of options for mxmlc, you can use the  helplist  option, as the following example shows:   mxmlc -help list

To see a list of all options available for mxmlc, including advanced options, you use the following command: mxmlc -help list advanced

默认的输出文件名同根应用文件名相同。输出目录也同目标文件所在位置一样,除非你通过output选项指定了输出目录。

The mxmlc command-line compiler does not generate an HTML wrapper. You must create your own wrapper to deploy a SWF file that the mxmlc compiler produced. The wrapper is used to embed the SWF object in the HTML tag. It includes the<object> and <embed> tags, as well as scripts that support Flash Player version detection and history management. For information about creating an HTML wrapper, see Creating a Wrapper.

mxmlc工具利用在flex-config.xml文件的设置作为默认编译选项。This file is in the flex_sdk_dir/frameworks/ directory. You can change the settings in this file or use another custom configuration file. For more information on using configuration files, see About configuration files.

The mxmlc compiler is highly customizable with a large set of options. For information on the compiler options, see About the application compiler options.

You can also open the mxmlc compiler with the java command on the command line. For more information, see Invoking the command-line compilers with Java.


 

原创粉丝点击