flashactionscript-3

How can I get started with ActionScript?


I would like to learn a bit about using ActionScript. I currently know zero about Flash and such, so I kind of want to learn a bit, so I am not so lost when it comes to this subject. Are there some really simple tutorials on how to get started?

Please include:

Something as simple as a Hello, World! would be fine. At this moment, I don't even know the difference between ActionScript and Flash.


Solution

    1. Get yourself a copy of FlashDevelop
    2. Create a new project
    3. Select from the dialog "AS3 Project"
    4. Open the Main.as file
    5. Save the below
    6. Hit F5 to Test Movie, your first Hello World

      package {
          import flash.display.Sprite;
          import flash.events.Event;
          import flash.text.TextField;
      
          public class Main extends Sprite 
          {
              public function Main():void 
              {
                  if (stage) init();
                  else addEventListener(Event.ADDED_TO_STAGE, init);
              }
              private function init(e:Event = null):void 
              {
                  removeEventListener(Event.ADDED_TO_STAGE, init);
                  var txt:TextField = new TextField();
                  txt.text = "Hello World";
                  addChild(txt);
              }
          }
       }