Accessibility

Flex Quick Start: Getting started

Table of contents


Creating your first application

MXML files are ordinary XML files, so you have a wide choice of development environments. You can write MXML code in a simple text editor, a dedicated XML editor, or an integrated development environment (IDE) that supports text editing. Flex supplies a dedicated IDE, Adobe® Flex™ Builder™ 3, that you can use to develop your applications.

The first line of the MXML file is the XML declaration. This line has to be the first line in each MXML file.

The next line is <mx:Application> tag, which defines the Application container that is always the root tag of a Flex application.

The <mx:Panel> tag defines a Panel container that includes a title bar, a title, a status message, a border, and a content area for its children. Its title property is set to "My Application".

The <mx:Label> tag represents a Label control, a very simple user interface component that displays text. Its text property is set to "Hello, World!".

The fontWeight and fontSize properties of the <mx:Label> tag change the style of the font used. You can also use CSS to style your components. For more information, see "Using Cascading Style Sheets (CSS)" in the Flex 3 Developer's Guide.

Note: You can compile your Flex application by using the command-line compiler mxmlc, or by using Flex Builder 3. For instructions on compiling your application with mxmlc, see the Coding with MXML and ActionScript tutorial.

Example

<?xml version="1.0" encoding="utf-8"?>

<mx:Application 
    xmlns:mx="http://www.adobe.com/2006/mxml" 
    viewSourceURL="src/HelloWorld/index.html"
    horizontalAlign="center" verticalAlign="middle" 
    width="300" height="160"
>
    <mx:Panel 
        paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10"
        title="My Application"  
    >

        <mx:Label text="Hello World!" fontWeight="bold" fontSize="24"/>
    </mx:Panel>
</mx:Application>

Result

AlertThis content requires Flash

Download the free Flash Player now!

Get Adobe Flash Player

To view the full source, right-click the Flex application and select View Source from the context menu.


For more information

About the author

Aral Balkan acts and sings, leads development teams, designs user experiences, architects rich Internet applications, and runs OSFlash.org, the London Macromedia User Group, and his company, Ariaware. He loves talking design patterns and writing for books and magazines. He also authored Arp, the open-source RIA framework for the Flash platform. Aral is generally quite opinionated, animated, and passionate. He loves to smile, and can even chew gum and walk at the same time.