Compiling Flex Modules


I am developing a Flex web application (IDEA 13) and my application displays some complex fxg artwork. The User makes a radioButton choice on startup and the appropriate fxg files are displayed.

To make the application more efficient I have created Modules in the following way:

  1. I created a new package named 'artwork' and placed all of the fxg files within.
  2. I created a new package named 'modules' and created a Module for each fxg file, example below.
  3. Within the Module Settings > Build Configuration I added the Modules to the list of Runtime-Loaded Modules and checked the Optimize checkBox.
  4. Compiled the application and all of the swf files were created as expected.
  5. Added ModuleLoader components to pull in the swf files when required.

What concerns me is that when built the application swf file is no smaller! Its as if because the fxg files and Modules are still within the src folder they are being compiled into the application still.

I have also created a new Project, copied the fxg files into a package there, created the Modules and can build the swf files from here as well (I created a link-report in the master application and used this when building the Modules).

It is much easier to have everything together in the main application, can anyone please explain where I am going wrong.



1 comment
Comment actions Permalink

Of course you shouldnn't create separate projects for your task. If you need to separate parts of the project you can create more than one modules (here I mean IntelliJ IDEA modules, not Flex runtime-loaded modules).
But according to your description one IDEA module is enough and looks like you configured everything correctly.
'Optimize modules' feature makes SWFs for runtime-loaded modules (RLMs) smaller, it doesn't affect main app.
The size of the main app SWF depends only on the amount of classes that are accessible directly or indirectly starting from the main class that you have set. It is absolutely ok to keep all sources in src even if not all of them are needed for the main app. You may try an experiment: make main class as simple as possible (like a single <s:Application xmlns=.../> tag) and you'll see that SWF becomes smaller.
So you need to check that there are no references to classes that you do not want to be included into the main SWF.


Please sign in to leave a comment.