Define your own components
In Flex, you can create your own components from the beginning or by extending components existing in the Flex component library. Creating a component is like creating an app: use the MXML to raise the user interface, write the interface logic with ActionScript.
One of the following examples is to create a simple credit card selection component by extending the VBox class.
Xml Version = "1.0" encoding = "ISO-8859-1"?>
Label = "American express" SELECTED = "true" /> mx: vbox> The name of the component is the name of the source file. For example, the name of the source file is CreditCardchooser.mxml, the name of the component is CreditCardchooser, so that this tag name can be used. The following example uses the CreditCardchoose component that just created. Xml Version = "1.0" encoding = "ISO-8859-1"?> mx: Application> Figure 3. CreditCardChooser application Interface developers can also create complex visual components in the Macromedia Flash development environment and save them as SWC files. Of course, it is also possible to define the entire component using only ActionScript, which is generally used to define non-visible components in the application. You may create non-visual components for such business objects - for example, a shopping cart with client logic, or a Helper class in your application.