Like Flex Builder 2's compiler, mxmlc stipulates that a program's main class must reside in the unnamed package. Therefore, before compiling the virtual zoo program with mxmlc, we must first move VirtualZoo from zoo to the unnamed package by following the steps listed in the earlier section "Moving the Main Class to the Unnamed Package."
Next, we must locate the compiler itself, which is named mxmlc.exe. The location of the compiler varies by version and operating system. Typically, it resides in a folder called Flex SDK [version]\bin, but you should confirm the location for your computer according to the documentation provided with Flex SDK. For the purposes of this example, we'll assume that we're compiling on Windows XP, and that the compiler resides in the following location:
C:\Flex SDK 2\bin\mxmlc.exe
We'll also assume that our /virtualzoo/ program folder resides in the following location:
To compile the virtual zoo program using mxmlc, we follow these steps:
From the Windows start menu, open a command prompt by choosing Start → All Programs → Accessories → Command Prompt.
At the command prompt, change to the C:\Flex SDK 2\bin\ directory by entering the following command:
cd C:\Flex SDK 2\bin
At the command prompt, enter the following command, then press Enter:
In response to the preceding steps, mxmlc compiles the program, and generates a .swf file named VirtualZoo.swf, which it places in the virtualzoo\src ...