Categories
Articles

Using MXMLC for Sharing Common Libraries

When using mxmlc (the Flash Flex AS3 command line compiler) I wanted to create a folder structure for sharing a common libraries but for different examples and apps that have their own sibling folders. This would keep the parent folder of both the library and the apps clean.

Ex:

com.hosford.core

com.hosford.controls

apps.clock

apps.diceRoller

I use Windows and batch files for mxmlc. I prefer to copy a new version of the batch for each need and edit rather than type at the command line. Thus I can just click the batch file in a Window for each iteration.

I also do not use any environment variables so the batch file allows for hard paths were needed.

Assume in apps.clock the source file was ClockApp.as

Its package would be:

package apps.clock{

The imports are as you can expect:

import com.hosford.controls.* 

The mxmlc line is in a Windows batch file is as follows:

"C:\Program Files\Adobe\Flex Builder 2\Flex SDK 2\bin\mxmlc.exe" "-source-path+=../../" "-file-specs=ClockApp.as"


The -source-path option is the item that allows ClockApp.as to find the com libraries. The += adds to any environment path you also have.