
175
15
CHAPTER 15
Create a Custom Component
Creating custom MXML components can simplify the process of building complex
applications. By breaking down the application into manageable chunks, you can write and
test each component independently from the others. You can also reuse a component in the
same application or in other applications, which saves development time.
This lesson shows you how to build an MXML component visually with Adobe Flex Builder
and then how to insert it in an MXML application file.
In this lesson, you’ll complete the following tasks:
Set up your project. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
Create a test file for the custom component. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
Create the custom component file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
Design the layout of the custom component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
Define an event listener for the custom component. . . . . . . . . . . . . . . . . . . . . . . . . . 180
Use the custom component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
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 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.
Kommentare zu diesen Handbüchern