|
MXML
MXML is an XML language that you use to lay out user-interface components for Adobe® Flex™ applications. You also use MXML to declaratively define nonvisual aspects of an application, such as access to server-side data sources and data bindings between user-interface components and data sources.
For example, you use the
The following example shows the complete code required to create a Flex application that displays a Button control:
After you write a Flex application, you must compile it using the Flex compiler. The Flex compiler is a small executable file called mxmlc in the Flex SDK 2.0\bin folder under your Flex 2 installation folder.
Tip: Ensure that the Flex 2 installation folder\Flex SDK 2.0\bin folder is in your system's path. Having the Flex compiler in your path allows you to invoke it from the command line regardless of the folder you are currently in.
- Instructions
Create a new file in your favorite text editor (e.g., Notepad) and save it as MyFirst.mxml.
Enter the code from the preceding example into MyFirst.mxml and save your file.
Open up a command window by selecting Start > All Programs > Accessories > Command Prompt.
Change your current directory to the folder that contains the Flex application you saved in step Type the following command to invoke the Flex compiler:mxmlc --strict=true --file-specs MyFirst.mxml
The items in the command string that start with double dashes are known as compiler options, and they are used to define the behavior of the Flex compiler. In the preceding example, you set the --strict option to true to force the compiler into strict mode. In strict mode, the compiler has higher expectations of your code. For example, it expects you to statically type your variables. You use the --file-specs option to specify the MXML file that is compiled.
Either double-click the SWF file in Windows Explorer or enter its name in the command line to open it up in the standalone Adobe Flash Player 9.