
176 Create a Custom Component
Create a test file for the custom
component
You decide to build a login box as a custom MXML component. Before you start, however,
you need to create an MXML application file to test it. An MXML application file is an
MXML file that contains the
<mx:Application> root tag. You can’t compile and run an
MXML component on its own; you must instead compile and run an MXML application file
that uses the component.
In this section, you create an MXML application file to test your custom component.
1. With your Lessons project selected in the Navigator view, select File > New > MXML
Application and create an application file called Main.mxml.
2. Designate the Main.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, add a Panel container to the Main.mxml file by
dragging it from the Layout category of the Components view (Window > Components).
The Panel container is listed in the Layout category of components.
4. Select the Panel container in the Main.mxml file and set the following properties in the
Flex Properties view:
■ Title: Main Application Window
■ Width: 375
■ Height: 300
■ X: 20
■ Y: 20
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.
Comentários a estes Manuais