
104 Create Your First Application
When you create a project, Flex Builder creates a main application file and names it based on
the project name. An application file is an MXML file with an
<mx:Application> parent tag.
Your project can have several application files, but the main application file is the file Flex
Builder compiles into the application SWF file during builds. You can designate another
application file as the main application file to be built, but it’s good practice to have only one
application file per project.
Now that you understand the basic concepts of compiling applications in Flex Builder, you
can create a small application in Flex Builder, and then build and run it.
For more information about how projects are built, see “Understanding how projects are
built” in Using Flex Builder 2.
Create and run an application
The steps in this section assume you created the Lessons project and that automatic builds are
enabled. For more information, see “Create the Lessons project” on page 101.
1. If the Lessons.mxml file is not already open, double-click it in the Navigator view to open
it in Flex Builder.
2. Switch to the MXML editor’s Source mode by clicking the Source button in the document
toolbar.
Flex Builder inserted the following code in the Lessons.mxml file when it created it:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute">
</mx:Application>
3.
Add a Panel container by entering the following <mx:Panel> tags between the opening and
closing
<mx:Application> tags:
<mx:Panel title="My Application" width="200" height="300">
</mx:Panel>
Panel containers are the basic building blocks of many Flex layouts.
4. Add a Label control by entering the following <mx:Label> tag between the opening and
closing
<mx:Panel> tags:
<mx:Label text="Welcome to Flex!" mouseDownEffect="WipeRight"/>
Comentários a estes Manuais