actionscript

Love it, hate it -- either way, ActionScript is what makes Adobe Flash more than just an animation program.

Teaching code or scripting to journalists can be a challenge -- but it opens so many doors! Working in Flash, we need to learn certain basic scripts tp make buttons work, to control audio, to load photos into a package, and so on. The fundamentals of programming that you'll acquire can easily to transferred to JavaScript, which has the same parent language as ActionScript.

Here are several basic AS3 tutorials you can download and learn from.

If you're ready to move one step beyond the basics, then check out How to Do Stuff in Flash with ActionScript 3.0 (AS3). This is a more varied set of examples to download.

ActionScript 3.0 vs. ActionScript 2.0

For a while I was one of those people who complain about AS3, but no more. What really changed my tune was the way AS3 handles XML data; it's a huge improvement over AS2.

If you're new to Flash and you're searching for tutorials online, it's very important to understand that AS3 and AS2 are about as different as a horse and a dog, and you cannot mix them. Don't waste your time with AS2. Before spending time with any tutorial, make sure it is using AS3.

Getting Started

Assuming you don't know anything about scripting, think back to algebra class.

a = 2
b = 3
a + b = 5

Okay, algebra class was harder than that, but I'm offering that idea to show you that you already understand one of the basic concepts of scripting: variables. If a stands for 2 and b stands for 3, you understand that a + b must equal 5. In ActionScript, that might look like this:

var a:Number = 2;
var b:Number = 3;
var total:Number;
total = a + b;
trace(total);

The result would be that Flash would show the number 5 in the Output window. A lot of basic Flash tutorials use trace to teach you how to do things, but trace does not produce anything the users can see in the final Flash movie (the SWF file) on the Web. That's why I do not use trace in my basic AS3 tutorials, which center on helping you understand how to do things with buttons in Flash.

Understanding variables is essential if you're going to write code. Scripting a Calculator with ActionScript (AS3) is an introduction to AS3 variables that uses a simple gas mileage calculator to explain how variables work.

I would guess that 90 percent the work that 75 percent of Flash developers do in their work involves simple buttons. Buttons open and close things, load and unload content, stop and start processes (like playing videos), and allow users to skip around to view different parts of a package.

So start with buttons, and then move on -- to more ActionScript! See the AS3 Buttons tutorial.

Tutorials for ActionScript 3.0

Here are a few free tutorials that other people have made and that I recommend:

AS3 101: Variables – Basix: Dumb name, great tutorial for absolute beginners. It is the first in a series from the great folks at Activetuts+; the series is called AS3 101.

Taking a Closer Look at the ActionScript 3.0 Event Framework: This is really, REALLY good, but NOT for your very first tutorial. You are using MouseEvents as soon as you start using buttons in Flash, and after a little practice, you should find out more about how they work. This is a great resource for taking that step (also from Activetuts+).

Understanding Functions: I really like the way this lays out the concepts for how and why functions are used in programming. It's part of a set of tutorials called Flash and Actionscript 911 (from game designers Untold Entertainment).

Learn ActionScript 3 by Following this Simple Avoider Game Tutorial: I don't write ActionScript this way -- in classes, with external .as files. But hardcore programmers do. This tutorial is recommended all over the Web. It's a classic, and it's really well done. But keep in mind, for little journalism projects, you don't need to go to all this trouble!

Having trouble with embedded fonts and HTML text in Flash CS5? This is related to ActionScript, although it's not always explicitly in the ActionScript. When we load and unload text dynamically in Flash (which is done in journalism applications all the time), we need to embed the fonts we want users to see. (Normal Flash text -- static text -- doesn't require this.) In CS5, the way to do this changed significantly -- and this article is the best I've found explaining the new way to embed your fonts. Here is a more illustrated tutorial: Use Embedded Fonts in Flash CS5.