Posted by GusHiguera in Air, Flex, Web | 3 Comments
How to Generate a Flex/Air Configuration File
For my first post in the Web section I’m gonna talk about configuration files for Flex and Air.
These files come in real handy when trying to automate the build process of a Flex or Air application which is how I learned how to correctly used these files. You can use the mxmlc command-line utility to generate a configuration file or follow these steps to generate one from Flex Builder
1) Go to Project > Properties > Flex Compiler
2) In the additional compiler arguments text field enter:
-dump-config my-config.xml (where “my-config.xml” == the name of the config file you want to be created)
3) Clean your project
4) Refresh you project folder and you should now see your config file in your projects’ main src directory
Well, now you have the option to modify and manually configure your Flex or Air application. To load this config file to build your application, using the same step above you just enter the following compiler option in step 2:
-load-config my-config.xm
This same process can be used to create a configuration file for an Air application as well. After the file has been created, open it up and take a look inside. I learned a great deal about creating custom Flex configurations just by looking at the properties in this file. When using tools like Ant and Maven to automate your build process these files can be used to make your life a whole lot easier. I’ll be talking about that process in some of my next posts.
For now, here’s what Adobe has to say about configuration files.
Configuration files can be used by the command-line utilities, Flex Builder, and the web-tier compiler.
Flex includes a default configuration file named flex-config.xml. This configuration file contains most of the default compiler settings for the application and component compilers. You can customize this file or create your own custom configuration file.
Flex Data Services include the flex-config.xml file in the flex_webapp_root/WEB-INF/flex directory. Flex 2 SDK includes the flex-config.xml file in the flex_install_dir/frameworks directory.
The Flex Builder compilers do not use a flex-config.xml file by default. The default settings are stored internally. You can, however, create a custom configuration file and pass it to the Flex Builder compilers by using the load-config option. Flex Builder includes a copy of the flex-config.xml file that you can use as a template for your custom configuration file. This file located in the flex_builder_install_dir/Flex SDK 2/frameworks directory.
You can generate a configuration file with the current settings by using the dump-config option, as the following example shows:
mxmlc -dump-config myapp-config.xml














Hi, if you’re seeing this post. I’d like to get some feedback if this has helped anyone
Hi!
Well, it helped a bit. Everyone who tries this and gets an error that his custom config file couldn’t be found, should move that xml to his project’s source-folder.
Kind Regards,
Daniel
Thank you so much for this! You saved me a lot of time and pain.