Adobe FLEX 2-PROGRAMMING ACTIONSCRIPT 3.0 Manual page 33

Programming actionscript 3.0
Table of Contents

Advertisement

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" backgroundColor="#DDDDDD"
editable="false" />
<mx:HBox width="400">
<mx:Label text="User Name:"/>
<mx:TextInput id="userNameTxt" width="100%" enter="mainTxt.text =
myGreeter.sayHello(userNameTxt.text);" />
</mx:HBox>
</mx:Application>
4.
Save the edited HelloWorld.mxml file. Select File > Run to run the application.
When you run the application, you will be prompted to enter a user name. If it is valid
(Sammy, Frank, or Dean), the application will display the "
confirmation message.
Running subsequent examples
Having developed and run the "Hello World" ActionScript 3.0 application, you should have
the basic knowledge you need to run the other code examples presented in this book.
Subsequent code examples will not be presented in a step-by-step tutorial format as this one
was. The relevant ActionScript 3.0 code in each example will be highlighted and discussed,
but instructions about running the examples in specific development environments won't be
provided. However the example files distributed with this book will include all of the files you
need to compile and run the examples easily in your chosen development environment.
Hello, userName
Example: Creating a basic application
"
33

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flex

Table of Contents