ActionScript 3 Tutorials

A basic introduction to ActionScript 3 for complete beginners. This series will help you script in the timeline of a Flash file to make a point and click adventure game.

Watch the entire playlist here

  1. The basics
  2. Object properties
  3. Functions and Events: Part 1 & Part 2
  4. Linking and removing event listeners
  5. If statements and relative settings
  6. Variables
  7. Text fields

Monthly tutorials covering a range of topics and skill levels. Some projects will link to a mini competition tied to the tutorial content – show me your class!

Each project is in stages and the source material can be downloaded for the start of each section meaning you can jump right in whenever you please!

A slightly lengthy (and sometimes messy!) tutorial taking you through the development of an entire Flash game using a combination of keyframe and external coding. You should complete the intro series before progressing to this one. Please note, the main point of these tutorials isn’t to make the depicted game but to be able to apply the skills to any product; maybe you could try to build something totally different as you watch!

Watch the entire playlist here or Play the game!

  1. Series introduction
  2. Setting up an ActionScript file
  3. The document class and instance spawning
  4. Adding a mouse-controlled turret
  5. Shooting bullets
  6. Arrays
  7. For loops
  8. Hit tests
  9. Custom functions
  10. Packages and static classes
  11. Content bonus #1
  12. Font Management and a Menu
  13. Drawing lines with the graphics object
  14. Tweens and Explosions
  15. Code refactoring
  16. Dying and Scoring
  17. Dispatching Events and making your own Event types
  18. Frame labels and Try-Catch statements
  19. Tweening menu transitions
  20. Timers and an infinite loop
  21. Timing without Timers
  22. Key press events
  23. Adding power-ups
  24. Adding health and timer bars
  25. Switch case statements and key combinations
  26. Intro to sound
  27. Garbage collection
  28. Extending your classes
  29. Circular collisions
  30. Content bonus #2
  31. Adding a loading/downloading display
  32. Editing the right-click / context menu
  33. Uploading a game to Kongregate
  34. Series summary

A series of tutorials made randomly when I had time. There’s no voice over and the difficulty level and content of each differs greatly. Hopefully you’ll find something useful though!

49 Responses to ActionScript 3 Tutorials

  1. avatar XavZz says:

    Hello there,

    and to start with.. THANK YOU SO MUCH
    this is exactly what I need to get started

    I just learned how to use basic go to certain frame AS2,
    but I aspire to make games ad eventually also get some on Kong

    although I’m eventually aiming towards website design in Flash
    I have no doubt all this will come in handy

    thanks again for putting so much effort in documenting and filming
    all the steps, no matter how small.

    Maybe I’ll let you know something .. one day, thanking you once more for being the base I started building on. Haha ;D

    -Xz

  2. avatar Hugo Jesus says:

    Hi Anthony!

    Found your tutorials on youtube, and been watching them learning about AS3.

    I had Computer Eng. classes so the code stuff its not strange, and you have a nice way of arranging your code.

    I aim to be a game developer, unfortunely the course that you teach doesn’t exist in Portugal, so I guess I’ll stick to you for learning 😉

    Continue your great job, and enlight us with your knowledge eh eh eh :)

    Regards

    Hugo

  3. Hi!

    I’ve created a game by the help from your tutorials, and I’m wondering if you know how to make your own highscore table to put up on your own website?

    I’ve tried many things, but alot of the tutorials out there are either as2.0 or totally useless…

    Your tutorials are easy to understand and you explain what you do very well!

    So far I’ve used swf>php>mysql but when I upload the swf to a server it doesn’t put any data into the database.

    It does when I test the swf by ctrl + enter…

    It’s really getting me frustrated and if you could help me it would be awesome!

    -Gustav

    • avatar Ant says:

      You could use mochi media; the score system there lets you have high score tables outside of the swf file. It also does adverts, generates a bit of money and adds some obfuscation to your code to help against code thieves. There’s a post on the site with a mental maths scoreboard to give you an idea of the results. I only have my phone available to me for a couple of days so I can’t help much more right now and it’s a LONG time since I did any php I’m afraid!

  4. avatar konrad says:

    Hi Ant, just a quick thank you for your brilliant tutorials and calm, thoughtful teaching approach. I’ve learnt a lot and will watch this space with eager anticipation. Thanks again.

  5. avatar daniel says:

    http://www.subtleimaging.com.au/flashsite/Home2.html…. and
    thanks to you (” this is just the begining”) thanks mate:) instant hero:)
    http://www.subtleimaging.com.au/boloxous/gamefile.html
    I own cs3 and have trouble withya gabage collection and circular hit testing???
    it just dont work do i need to import some thing??
    thanks mate, have a good day.

    • avatar Ant says:

      Hey Daniel,

      The circular hit tests should definitely work in CS3, as it’s just a bunch of sums rather than use of any specific library.

      Good to see you making something with the tutorials, keep at it! :)

      Ant

  6. avatar Naki says:

    Hi Mr. Ant I’m having a problem with my keybaord event because whenever I press letters there is no response/trace on the Output panel. It only works on the numpad and arrow keys and other buttons except on the letters. I don’t know if the problem is in my keyboard and here is the code in my timeline.

    stage.addEventListener(KeyboardEvent.KEY_DOWN,KeyIsDown);
    function KeyIsDown(e:KeyboardEvent):void{
    trace(e.keyCode);
    trace(e.charCode);
    }

    I compiled it and no errors have been returned but still not working. Need some advice. Thanks.. :)

    • avatar Ant says:

      Hmm, that’s an odd one! I put your code into a Flash file and it works perfectly…

      First off, just check that you have disabled keyboard shortcuts when you test your SWF (Control -> Disable Keyboard Shortcuts). Other than that, I’m really not sure – it could be a specific keyboard problem I suppose.

  7. avatar Naki says:

    I just disabled the keyboard shortcuts and it works perfectly now.

    Thank you for the help Mr. Ant. :)

  8. avatar Ace says:

    Hello,Mr.Ant,I just made a menu screen for my game by following the tutorial in youtube: Point,click and win’s Game Development in AS3 Part 11 – Font Management and a Menu.Now,how do I trigger the game to start when the start button is clicked?(As expected,since my document class has no constructor,the screen is blank when the start button is clicked.)
    Cheers

    • avatar Ant says:

      I’m a bit lost :)

      The tutorial covers that from what I remember! If you’re totally lost you can drop me an email with the file and I’ll point you in the right direction

      • avatar Ace says:

        OMFG!! You’re right! I must be having Alzheimer’s disease :(
        Thanks for answering such a stupid question.

        Now,I have another one .When uploading a game onto kongregate,
        what code should I add for badges?

        • avatar Ant says:

          Kongregate decide which games get badges. If you want to have a chance you need to have a good rating and use the Kong API to submit suitable stats. I cover the stats part in the PCW series. I can’t make Kongregate choose your game though 😉

          • avatar Ace says:

            So,you’re saying I don’t need to add code for badges when uploading my game onto the site but I have to add it when my game gets selected and then upload a new version of the game having code for badges?
            1.>How do I make sure that player’s save files don’t get erased?
            2.>Could you give me a tutorial of how to write code for badges in AS3?

        • avatar Ant says:

          I can’t reply to your newest post (guess that’s just an issue with the site’s theme) so I’ll reply here:

          You should put stats into your game from day 1 if you are going to put it on Kongregate. Any badges added to the game are made by using the stats your game already submits. So, for example, you might save a player’s high score and Kongregate might come along and decide that any scores over 1000 get a badge. Make sure those stats are in from day 1!

          You don’t really have much control over the deletion of player’s save files if you are using a SharedObject; you just have to hope they don’t wipe their temp internet files all too often. You could save their files using Kong’s API but you’ll have to look into that one as I’ve never done it myself.

          I show you how to put Kong stats into your game in one of the PCW tutorials up top ^ (the uploading to Kongregate one)

          • avatar Ace says:

            Thanks,that cleared up a lot of doubts. :)
            To think that I was super programming phobic a week ago.Your tutorials are the only ones that showed awesome clarity.You rock,man and I hope you know you’re like a mentor to me no,seriously,if it wasn’t for your tutorials,I wouldn’t be able to even put an object on the stage.
            BTW,what’s your mail ID?Can’t find it anywhere.

  9. avatar Shadyman666 says:

    Does this code work for a site lock?
    if (loaderInfo.url.toString().indexOf(“www.kongregate.com”) != -1)
    {
    //kill code
    }

    • avatar Ant says:

      I think the logic is the wrong way round but Kongregate games aren’t hosted on http://www.kongregate.com anyway. Try “chat.kongregate.com” instead (or just “kongregate.com”)

      if (loaderInfo.url.toString().indexOf(“kongregate.com) < 0)
      {
      //kill code
      }
  10. avatar tom says:

    hey here is a link to my version of the copter game i did it for android phones though. look if interested

    https://play.google.com/store/apps/details?id=air.tombala.SuperSperm&feature=search_result#?t=W251bGwsMSwxLDEsImFpci50b21iYWxhLlN1cGVyU3Blcm0iXQ..

  11. avatar tom says:

    hey man ur videos are awsome u are the man just wondering if any of u your videos show how to make a highscore board that saves and updates itself if not that would be a kwl idea

    • avatar Ant says:

      I’ll probably do something along those lines eventually but you could use the Kongregate or MochiMedia scoreboards for now.

      If you want to research making your own offline one you should look at SharedObjects

  12. avatar Luke says:

    Hey Ant, thanks a lot for your videos. You’ve been very helpful, and I’ve learned a lot.
    I had a question, how can I lower the brightness of an object with AS3?
    I’ve tried using:
    object.brightness = -50
    but that does nothing.

    • avatar Ant says:

      Hi Luke, good to hear :)

      The brightness property doesn’t work, I’m not quite sure why it’s there. You will need to use a ColorTransform, a ColorMatrixFilter or possibly just a Color (fl.motion.Color) to tint the object black. I covered tinting in the ‘Copter’ tutorial in the AS3 tutorials section of the site

  13. avatar Charlie says:

    Hi Ant I really like your coding videos, I think they’re really cool. I have actionscript 2.0 and was wondering if I could still do some of the stuff you do with actionscript 3.0. Is there much of a difference?

    • avatar Ant says:

      There’s a pretty big difference, so none of the tutorial content from here will work in AS2 unfortunately. I don’t even know where to point you for AS2 anymore, I’d definitely recommend taking the step up to AS3 though!

  14. avatar dragonpro908 says:

    wow i played your game the player is cannon the enemy end of the arrow

  15. avatar Przemek says:

    Hey Ant, I just borrowed AS3 book from the College Library and when reading it, sometimes I don’t get a thing. Your tutorials are clean and nice so maybe you should think about writing a one about Flash and AS3?

  16. avatar haso says:

    Wow, again thank you very very very much. Great tutorials, I wish you all the best, and God bless you.
    Thank you up to sky :)

  17. avatar Nishchal says:

    Respected Sir,
    I m totally novice to flash , and have started learning from tuts , hope it will take me to climb in gaming world , as i found ur efforts very systematic n arranged so that they may allow us to understand instead learning them … so i request u to keep continue to programme new tuts like these, so that this generation would also enable to help n come forward to give something new to their next generations .
    I do thanks to u n praise u , although i don’t know u , this is what u deserve , u not only earn money thats how u also earn respect , Now whenever u to INDIA , i m here to welcome u by heart …. n us show our hospitality….. God bless u thanks

  18. avatar Nishchal says:

    “this is what u deserve , u not only earn money but also earn respect , Now whenever u to visit INDIA , i m here to welcome u by heart “

  19. avatar Pedro says:

    I did everything as you said and it all went well 😀
    I just have one question: How do i set the copter’s collision box a custom shape ( the copter’s shape itself) ?

    Nice tutorials Ant, I discovered the power of flash thanks to u xD

  20. avatar Jason says:

    hey, just wondering if you would be able to help putting a high score into the copter game?

    cheers

    • avatar Ant says:

      Hi Jason,

      Have a look into using SharedObjects, specifically SharedObject.getLocal – there should be plenty of tutorials out there

  21. avatar Zain says:

    please help me with the game over in copter style game .. i cant stop the blocks when the game is over . please explain in detail. i Have seen your comments but i didnt understand . Thankyou

  22. avatar Zain says:

    Hello sir.

    I am making round Objects in “copter style game ” . So the object is round and the object border is in square shape . whenever Helicopter come near that square it’s distroyed and it never reaches to that round obstacle.
    Please help me with this problem. Thankyou.

  23. avatar anto says:

    Hey ant,
    I’m a teacher and my name is anto too :)
    i create multimedia for learning including game with flash ( but mostly with a.s 2.0 ).
    i’m a beginner and i want to learn about a.s 3.0, so your video tutorial here are very very helpful for me.
    Thank you. Thank you.Thank you.

  24. I’m enjoying the classes and learning a lot, Ant! Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *