Hello World
AS3
My First Program in Flash
Below is the first program I ever wrote in ActionScript. It is a simple demonstration of some of the controls that are already available in the AS3 library.
Click on the button in the upper left corner to see what happens - exciting! The code for this demo is presented at the bottom of the page.
import flash.display.Sprite;
import flash.text.TextField;
import fl.controls.Button;
import fl.events.ComponentEvent;
import fl.controls.CheckBox;
import fl.controls.List;
public class HelloWorld extends Sprite {
//Code will automatically run here...
public function HelloWorld() : void {
b.label = "Click Me!";
addChild(b);
b.addEventListener(ComponentEvent.BUTTON_DOWN, ButtonHandler);
var c : CheckBox = new CheckBox;
c.label = "Click here!";
c.y = 50;
addChild(c);
var l : List = new List;
for (var i : int = 1; i <= 10; i++) {
l.x = 20;
l.y = 100;
l.rowCount = 8;
addChild(l);
private function ButtonHandler(e : ComponentEvent) {
t.text = "Hello World!";
t.x = 250;
t.y = 250;
addChild(t);
removeEventListener(ComponentEvent.BUTTON_DOWN, ButtonHandler);
}
}
Languages: ActionScript (AS3/AS2) • Ajax • Assembly • ASP • C • C++ • CSS • DHTML • HaXe • HTML/HTML5 • Java • JavaScript • JSON • jQuery • MySQL • Pascal • PHP • Visual Basic • XML
Software & Frameworks: Adobe Air • Adobe Flash • Android • Audacity • CoolEdit • Dreamweaver • Eclipse • Facebook Integration • FireBug • Flash Builder • FlashDevelop • Flex • Gimp • Illustrator • MacOS • Media Encoder • MS Office • Netbeans • Open Office • Photoshop • phpMyAdmin • TortoiseSVN • Visual Studio • Windows • XAMPP • UNIX