Adobe FLEX 2-PROGRAMMING ACTIONSCRIPT 3.0 Manual page 29

Programming actionscript 3.0
Table of Contents

Advertisement

To create an ActionScript application using Flex Builder:
1.
Open the HelloWorld.mxml file, and type the following code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*"
layout="vertical"
creationComplete = "initApp()" >
<mx:Script>
<![CDATA[
private var myGreeter:Greeter = new Greeter();
public function initApp():void
{
// says hello at the start, and asks for the user's name
mainTxt.text = myGreeter.sayHello();
}
]]>
</mx:Script>
<mx:TextArea id = "mainTxt" width="400" />
</mx:Application>
This Flex project includes three MXML tags:
An
<mx:Application>
An
<mx:Script>
An
<mx:TextArea>
The code in the
<mx:Script>
application loads. The
the "Hello World!" string returned by the
Greeter, which you just wrote.
2.
Select File > Save to save the application.
Continue with
"Publishing and testing your ActionScript application" on page
tag, which defines the Application container
tag that includes some ActionScript code
tag, which defines a field to display text messages to the user
tag defines a
method sets the text value of the
initApp()
sayHello()
method that is called when the
initApp()
method of the custom class
Example: Creating a basic application
TextArea to
mainTxt
30.
29

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flex

Table of Contents