Compile resource module using Flex builder


The steps to use resource modules can be found in my own post, and here.

The code snippets here refer to my post.

Although compiling resource modules is not built-in in Flex Builder, you can compile resource modules by using Flex Builder by adding a builder to your project as follows:

1. Right click on your project->Builders. This shows you the list of builders used for building your project. If you haven't added any builder, you should only see the "Flex" Builder.

2. Add a new builder by clicking "New". In the "Choose Configuration type" dialog, choose "Program"->OK. This enables you to run an executable.

3. Give the builder a meaningful name, such as "ResourceModule_en_UN"

4. In the "Main " tab of the builder editor, set the following:
location: The path to MXMLC.exe on your machine. Something like C:\Program Files\Adobe\Flex Builder 3\sdks\3.4\bin\mxmlc.exe

Arguments: the arguments for the mxmlc. Use different arguments depending on whether your output folder is regular (like bin-debug) or using Eclipse linked resources.

For regular output directory:

In case you use a typical output folder (e.g bin-debug), you can use the follows:
-source-path=${project_loc}\src\locale\{locale} -locale=en_US -include-resource-bundles=RegistrationForm,collections,containers,controls,core,effects,skins,styles -output =${project_loc}/bin-debug}\en_US_ResourceModule.swf

This will compile the resources to swf, and place it in your output bin-debug directory

For output folder using Eclipse linked resources
-source-path=${project_loc}\src\locale\{locale} -locale=en_US -include-resource-bundles=RegistrationForm,collections,containers,controls,core,effects,skins,styles -output ${workspace_loc:/${project_name}/bin-debug}\en_US_ResourceModule.swf
Explanation: When you use linked resources for your Flex output (your project's output folder contains something like ${OUTPUT_FOLDER} which was defined as a linked resource), Flex builder automatically creates a linked folder under your project named "bin-debug".
This folder is mapped to the path specified in the linked resource.
When you specify ${workspace_loc:/${project_name}/bin-debug}\ you tell the compiler to look for this folder under your project, under the workspace.
It is actually a logical place (try clicking on one of the "Browse workspace" buttons in this editor, choose a folder and see the result string).
This will compile the resources to swf, and place it in the folder specified in your linked resources.