Datasheet
Luchner c01.tex V3 - 03/20/2008 2:29pm Page 10
Chapter 1: The Development Environment
xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
windowComplete="completeHandler();">
<mx:Script>
<![CDATA[
// window has completed initial layout and is made visible.
private function completeHandler():void
{
trace( "Hello World!" );
}
]]>
</mx:Script>
<mx:Label text="Hello World" />
</mx:WindowedApplication>
2. Save the file as
HelloWorld.mxml
. Open a command prompt and change the directory to
the project development directory — for this example, that would be
C:
\
Development
\
AIR
\
HelloWorld
on Windows and
/Development/AIR/HelloWorld
on Mac. Enter the following
and press Enter:
> amxmlc -debug HelloWorld.mxml
In comparison to the previous
amxmlc
command, the
-load-config
and
-ouput
options
were omitted but generate the same result. Also added was the
-debug
option to generate a
SWF file that has debugging enabled. A SWF file with debugging enabled allows communi-
cation between the application and the Flash Debugger tool.
3. Before running the ADL again, you need to run the Flash Debugger (FDB) in order to view
the
trace
statement you added to the main file (
HelloWorld.mxml
). The FDB command-line
tool can be found in the
/bin
directory where you installed the Flex 3 SDK. Since you added
a path to the
/bin
folder of the installation to the system variables earlier in this chapter, you
only need to enter > fdb into the command prompt to start the debugger.
4. Open a separate command prompt and start the Flash Debugger by entering the following
and pressing Enter:
> fdb
The printout will end with the FDB display prompt
<fdb>
, meaning you have started the
Flash Debugger and it is ready to be run and connected with a launched debug SWF file.
Running the debugger enables you to see any
trace
statements you have in your Action-
Script code output in the console. Numerous other commands can be performed by the FDB,
including setting breakpoints and handling faults; enter the help in the console after the
command prompt to view these options.
If the preceding operation resulted in output on the console that states
Error: could not find a JVM
10