Programming Flash Games for Free Part 1: Hello World

Want to program Flash games for free? You can, using the tools I'll show you in this video tutorial. Learn how to write games and other graphically rich applications that run in a browser. This tutorial assumes that you already have at least some programming knowledge; we'll be writing our flash games in AS3 (Action Script 3), a Flash-based language that's rather similar to Java.

Note: FlashDevelop will automatically create an HTML file that shows you how to embed your SWF in an HTML page, although there are ways there are simpler.

Useful Links (Everything's free and mostly open source!)
FlashDevelop - a free IDE for programming Flash
Flex SDK (installed automatically by FlashDevelop, if memory serves ...
Flixel - we'll use this in the next tutorial to do some basic animation.

In this tutorial I'll show you how to develop this little flash app (which does nothing other than display the text "hello world"):


Get Adobe Flash player

Code for this tutorial (mostly automatically generated by FlashDevelop)

    import flash.display.Sprite;
    import flash.text.TextField;
     * ...
     * @author John W Purcell
    [SWF(width="640", height="480", backgroundColor="0x000000")]
    public class Main extends Sprite 
        public function Main():void 
            var txt:TextField = new TextField();
            txt.text = "Hello World!";
            txt.textColor = 0x00FF00;
            if (stage) init();
            else addEventListener(Event.ADDED_TO_STAGE, init);
        private function init(e:Event = null):void 
            removeEventListener(Event.ADDED_TO_STAGE, init);
            // entry point