MXMLC compiling multiple SWFS with SWC dependancies

530 views Asked by At

So I have a project comprised of multiple modules and I'm trying to work out the best way to compile, with minimal code duplication.

I have a core Framework SWF and a number of sub applications which are independent of core. In addition I have a series of common library SWCS which core and subapps are dependant on.

I'm not sure the best way to compile this project so that each module does not need to include the libraries as this would duplicate code. Would love some advice!

I started out with using external-library-path for compilation, but something is going to have to include the common libraries.

Thanks

2

There are 2 answers

1
Timofei Davydik On BEST ANSWER

As I understand, your core application contains modulemanager, which loads your subapps (modules), right?
In this case you can include your commons swc into your main applcation by using include-libraries parameter, and for the subapps use external-library-path. So, all classes from commons will be included into main app, and when subapps are loaded, they will use them.
You can also use your commons as RSL instead of including them into application.

0
JonnyReeves On

Using linkreport is a PITA and will complicate your build process.

The simplest approach is to use include-libraries as Timofei suggests; however, if you want a bit more flexibility (and reduce the amount of code your Players will have to download) then you should consider a 'SWF Library' approach.

Have all your shared library code compile as SWCs (for development) and SWFs (for run-time loading). Your 'sub-apps' should then define a list of dependencies on those library SWFs as part of a manifest / handshake method, ie:

libs: [ collections, widgets ];

Your main app is then responsible for knowing which libraries have been previously loaded, and resolving those that are missing.