Tips For Beginner Flash/Actionscript Developer

Are you leaning to ActionScript programming?

Do you need to write a bit more than just gotoAndPlay() and gotoAndStop()?
Or finally would like to try to make some animations via ActionScript and not in timeline?

Then please consider the following advices!

There are tips for ActionScript, though they should be interesting to AS2 and AS3 guys too.

1. Separate your code.

2. Order your objects in the library.

3. Have a naming standard.

4. Do reference the objects appropriately.

5. Always have the only one mainframe.

1. Separate your code.

In Flash IDE you may put your code in any clip or movie element of the stage. I know it’s pretty common to put a button press handler code to button clip using the code similar to:


Yes, it’s pretty clear, but only when developing a simple 5-10 buttons menu for a website.
When getting into more complex flash works with a complex hierarchy and nesting you will get lost in your movie for sure if you will need to get back to it in a week or two.

So, accept it as a rule. Do ALWAYS create a separate layer and name it ‘actions‘. This should be the only place for all your actionscript code.

As said Bill Perry of Macromedia:

I throw a flash movie away if I don’t fine the actions layer. Instead actions in this file has been written in bits in more than 20 places!”

Here is an example of the way to put the code in there:

// fdwButton is the name of your clip placed at the Stage
_root.fdwButton.onPress = function()

and so on with all other elements.

I believe this will simplify your future efforts when you’ll have all code in one place and will not need to browse through all the elements in timeline when something should be changed.

2. Order your objects in the library.

That will save you a lot of time if you will keep your object in an organized way.
Sort them in folders. And give all elements logical names. No more “symbol1” and “symbol2”.
Also, remove all unused objects from there as soon as they become useless, otherwise your compiled movie clip will be much larger because of garbage inside.

3. Have a naming standard.

Give the names for your actionscript objects and functions in a proper pattern, and keep doing this way all the time.
This will help you to understand the code. And will be much of thankful words if you’ll need to pass your project later to another actionscript developer

4. Do reference the objects appropriately.

Never ever mess the namespaces! If you’re using _root as a reference to some objects\clips, then use it for all the other clips. Try to do less referencing through this. or _global. in that case.

I would suggest you to create an empty objects as a namespace holders if there are a lot of stuff to organize. E.g.

_root.buttons = new Object();
_root.images = new Object();
_root.buttons.myButtonsRelatedVar = 1;
_root.buttons.myButtonsClipLoader = new MovieClipLoader();

5. Always have the only one mainframe.

This of course shouldn’t be considered for banners, or simple animations.
But this rule should be followed when doing the code.
You see, if you have more than one frame in your main timeline, all the code will be executed again, creating new variable and refilling them with the values.
If you write a code and need some animations, do the animations as movieclips, and only then put the movieclips onto the only mainframe.

Hope this will be helpful for someone.

Please visit our book store for more tips and tricks described in good books that we recommend. Some of them are just must-haves for beginner AS developers.

11 Responses to “Tips For Beginner Flash/Actionscript Developer”

  1. 1 alfred

    eow….. i want to make a simple flash for my website can you make me know….

  2. 2 Paul

    Hey Alfred,

    Let us know more about your flash needs.
    We can offer our service for you to help with any Flash\Actionscript assistance or development.

  3. 3 andy

    i have completed three flash projects so far but i am indeed a beginner. if anyone can offer help i would apperciate it.

  4. 4 Paul


    Let us know more about your requests.
    If you have particular topics in mind you wish to have good tutorials about we would be really glad to assist that way 😉

    Or please contact us with any other questions or requests.

  5. 5 andy

    well jus a few beginer tutorials so i candevelop my understanding would be great.

  6. 6 Zachary

    How about a simple animated rollover tut? I know AS 2 but now I have to relearn everything in AS 3.

  7. 7 Paul

    Andy, Zachary, That’s good – I think soon some new tuts will appear 😉 But anyway, I’m open for tutorial topics suggestions…

  8. 8 Paul

    Hey, now you can check new tut and use this described technique to code your animations in ActionScript.
    Flash Animation Tutorial

  1. 1 hgecom » Tips For Beginner Actionscript Developer
  2. 2 hggoto » Blog Archive » Tips For Beginner Actionscript Developer
  3. 3 Becoming a flash developer, actionscript coder, flex engeneer... What's your way? | FlashDaWeb Blog

Leave a Reply