
144 Use an Event Listener
Set up your project
Before you begin this lesson, ensure that you perform the following tasks:
■ If you have not already done so, create the Lessons project in Adobe Flex Builder. For
more information, see “Create the Lessons project” on page 101.
■ Ensure that the automatic build option is enabled in Flex Builder. This option is enabled
by default in the standalone configuration of Flex Builder but not in the plug-in
configuration. To enable it, select Project > Build Automatically.
Create a simple user interface
You decide to build a simple currency converter for your online store. You want the user to be
able to specify a dollar amount and click a button to get the equivalent amount in yen. The
first step is to design a simple user interface.
1. With your Lessons project selected in the Navigator view, select File > New > MXML
Application and create an application file called Events.mxml.
2. Designate the Events.mxml file as the default file to be compiled by right-clicking
(Control-click on Macintosh) the file in the Navigator view and selecting Set As Default
Application from the context menu.
3. In the MXML editor’s Design mode, drag a Panel container into the layout from the
Layout category of the Components view, and then set the following Panel properties in
the Properties view:
■ Title: Currency Converter
■ Width: 450
■ Height: 150
■ X: 20
■ Y: 20
4. Add two Label controls, a TextInput control, and a Button control to the Panel container
by dragging them from the Components view (Window > Components).
NOTE
For the purpose of these lessons, several application files are used in a single Flex
Builder project. However, it’s good practice to have only one MXML application file
per project.
Kommentare zu diesen Handbüchern