
The Flex programming model 59
Relationship of the Flex class hierarchy to MXML and
ActionScript
Flex is implemented as an ActionScript class library. That class library contains components
(containers and controls), manager classes, data-service classes, and classes for all other
features. You develop applications using the MXML and ActionScript languages with the class
library.
MXML tags correspond to ActionScript classes or properties of classes. Flex parses MXML
tags and compiles a SWF file that contains the corresponding ActionScript objects. For
example, Flex provides the ActionScript Button class that defines the Flex Button control. In
MXML, you create a Button control using the following MXML statement:
<mx:Button label="Submit"/>
When you declare a control using an MXML tag, you create an instance object of that class.
This MXML statement creates a Button object, and initializes the
label property of the
Button object to the string “Submit”.
An MXML tag that corresponds to an ActionScript class uses the same naming conventions as
the ActionScript class. Class names begin with an uppercase letter, and uppercase letters
separate the words in class names. Every MXML tag attribute corresponds to a property of the
ActionScript object, a style applied to the object, or an event listener for the object. For a
complete description of the Flex class library and MXML tag syntax, see the Adobe Flex 2
Language Reference.
Laying out your application
You declare a Flex user interface by using tags that represent user-interface components. There
are two general types of components: controls and containers. Controls are form elements,
such as buttons, text fields, and list boxes. Containers are rectangular regions of the screen
that contain controls and other containers.
At the root of a Flex application is a single container, called the Application container, that
represents the entire Flash Player drawing surface. This Application container holds all other
containers, which can represent dialog boxes, panels, and forms.
A container has predefined rules to control the layout of its child containers and controls,
including sizing and positioning. Flex defines layout rules to simplify the design and
implementation of rich Internet applications, while also providing enough flexibility to let
you create a diverse set of applications.
Kommentare zu diesen Handbüchern