简体   繁体   English

如何将mxml文件转换为即.swc文件的组件

[英]how to convert a mxml file to a compoent that i.e .swc file

您好我尝试使用Flex Builder将.mxlml转换为.swc文件,当我与其他应用程序集成时不起作用...任何人都可以说如何使用SDK获取.swc ... pls我需要非常清楚

In Flex Builder (Or Flash Builder) you need to create a Flex Library project. 在Flex Builder(或Flash Builder)中,您需要创建一个Flex Library项目。 Put that mxml file in the library project, right click and select "include in library" from the context menu. 将该mxml文件放入库项目中,右键单击并从上下文菜单中选择“包括在库中”。

The Flex Library project should generate a SWC with that class which you can then use in other proejcts by adding that SWC to the library path. Flex库项目应该使用该类生成一个SWC,然后将该SWC添加到库路径中,即可在其他项目中使用该SWC。

Flextras is right, but a little more clearly (since you haven't accepted it yet): Flextras是正确的,但要更清楚一点(因为您尚未接受它):

Within Flex Builder (I'm assuming Flex Builder 3, but it's probably the same in Flash Builder), go to File -> New -> Flex Library Project. 在Flex Builder中(我假设使用Flex Builder 3,但在Flash Builder中可能是相同的),请转到“文件”->“新建”->“ Flex库项目”。 Enter a name an click Finish. 输入名称,然后单击完成。 This creates your project. 这将创建您的项目。

Create (or copy) the files you wish to compile into the src folder in your new project. 将要编译的文件创建(或复制)到新项目的src文件夹中。 The trick is that when you copy a file to the src , it is NOT automatically included in the library's build, and hence it will NOT end up compiled in the resulting SWC. 诀窍是,当您将文件复制到src ,它不会自动包含在库的内部版本中,因此最终不会在生成的SWC中进行编译。

To include these files in the library build, right click on the project in the Navigator panel and select Properties. 要将这些文件包括在库构建中,请在“导航器”面板中右键单击该项目,然后选择“属性”。 Click on "Flex Library Build Path" on the left, and under the "Classes" tab on the right, click "Select All" (or check the boxes you wish to include manually). 单击左侧的“ Flex库构建路径”,然后在右侧的“类”选项卡下,单击“全选”(或选中要手动包括的框)。

Once your files are included in the library project's build path, simply build the project. 将文件包含在库项目的构建路径中后,只需构建项目。 The build should happen automatically, but you can go to the Project menu and select "Clean" to be sure. 构建应该自动进行,但是您可以转到Project菜单并选择“ Clean”以确保确定。 Ensure that your project compiles correctly (no compile errors), and a SWC file should be generated in the bin folder. 确保项目正确编译(没有编译错误),并且应在bin文件夹中生成SWC文件。 Note that pretty much whenever you change anything within the project's file structure, you will probably need to repeat the step of clicking "Select All" in the library build path. 请注意,几乎无论何时在项目的文件结构中进行任何更改,都可能需要重复在库构建路径中单击“全选”的步骤。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM