使用Flahs CS 4 创建 Flex组件
安装扩展工具包
要在 Flash 中创建 Flex 组件,必须为 Flash 安装 Flex 组件工具包。可使用 Adobe Extension Manager 来安装该组件工具包。组件工具包的某些版本可能不支持 Adobe® Flash® CS4 Professional 的所有功能,因此请务必从 www.adobe.com/go/flex_ck_cn 下载组件工具包的最新版本。
新建元件
选择命令菜单下的命令,即“将元件转换为 Flex 组件”或“将元件转换为 Flex 容器”。
注意要给元件起个名字,如TextArea
提示如下信息:
Command made the following changes to the FLA:
Turned on Permit Debugging
Turned on Export SWC
Imported FlexComponentBase component to library
Symbol "Text" can be used as a Flex component.
Select File > Publish to create the SWC file for use in Flex.
则转换成功
选择“文件”>“发布”,创建包含编译 Flex 组件的 SWC 文件。Flash 还会从主 FLA 文件创建一个 SWF 文件,但您可以选择忽略该 SWF 文件。现在,发布的组件 SWC 文件可以在 Flex 中使用了。
Swc文件引入Flex工程
把发布生成的Swc文件放到libs文件夹下。
在要引用该组件的Mxml文件下输入<local:TextArea id=”textArea” /> 即可引用该组件。