Datasheet

FIGURE 1.1
The Flex SDK and Flex Builder both compile source code in MXML and ActionScript, producing exe-
cutable applications that are hosted by the Flash Player on the Web or the Adobe Integrated Runtime
(“AIR”) on the desktop.
In these examples, I’m declaring an instance of an ActionScript class named Label. The Label
class is part of the Flex class library that’s included with both the Flex SDK and Flex Builder 3. Its
purpose is to present a single line of text in a Flex application.
Declaring objects in MXML
The Label class is represented in MXML as a tag named <mx:Label/>. To create an instance of
the
Label class using MXML and set its text property to a value of Hello World, declare the
tag and set the property as an XML attribute:
<mx:Label id=”myLabel” text=”Hello World”/>
This results in creating an instance of the Label class that is displayed in the application.
Declaring objects in ActionScript 3
The Label class also can be instantiated using ActionScript 3. When using the ActionScript 3 cod-
ing model, you first create the object using the class’s constructor method and then add the object
to the application’s display list so it becomes visible. You can set the
text property anytime after
creating the object:
import mx.controls.Label;
var myLabel:Label = new Label();
myLabel.text = “Hello World”;
this.addChild(myLabel);
Flex 3 SDK
(Free)
Development tools
Flex Builder 3
(Commercial license)
MXML
(Used XML structure)
Programming languages
ActionScript 3
(Based on ECMAScript)
Flash Player 9
(Web applications)
Runtime platforms
Adobe Integrated Runtime
(Desktop applications)
6
Flex Fundamentals
Part I
06_287644-ch01.qxp 6/23/08 11:28 PM Page 6