O'Reilly logo

Essential ActionScript 3.0 by Colin Moock

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Compiling with mxmlc

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:

C:\data\virtualzoo\

To compile the virtual zoo program using mxmlc, we follow these steps:

  1. From the Windows start menu, open a command prompt by choosing Start → All Programs → Accessories → Command Prompt.

  2. At the command prompt, change to the C:\Flex SDK 2\bin\ directory by entering the following command:

                  cd C:\Flex SDK 2\bin
  3. At the command prompt, enter the following command, then press Enter:

                  mxmlc C:\data\virtualzoo\src\VirtualZoo.as

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required