What Is ActionScript?

[ LiB ]

ActionScript is a powerful, full-featured language that is built into Flash. Believe it or not, ActionScript has really evolved since the earlier versions of Flash. It's now quite similar to other programming languages like JavaScript, Java, C, and C++.

ActionScript, for our purposes, is the best thing that has happened to Flash. Ever since the birth of full-blown scripts in Flash 5, the interactive industry hasn't been the same. These scripts can control Flash and basically make it do anything you want it to do. And the best part of writing scripts in Flash is that you can make Flash interactive. Without it, animations would be static and simply there for show, but with scripts, you can write code that can be used to make fully interactive games .

What are ActionScripts? ActionScripts are instruction code that control animations and program flow from inside Flash. And as of Flash 6, which is now known as Flash MX, ActionScript was made very flexible and more powerful than ever before. It can do almost anything your imagination can conceive. You do need to be a little speed-conscious, but I'll speak more about that later.

Let's go back to the architecture and see ActionScript's relationship to the rest of a Flash program. Check out Figure 2.2 for a visual.

Figure 2.2. Three places where scripts are stored

graphic/02fig02.gif


In Figure 2.2, you can see the familiar parts of every Flash movie. You learned about these in Chapter 1, but just as a refresher, the three parts are: the main Timeline, a Movie Clip and a button symbol. All these can contain ActionScripts and control the interactivity from within.

NOTE

NOTE

Learning ActionScript terminology is very important because if you can't speak like a Flash expert, you will never be one. As I go along, I will shout out important terms for you to memorize. But don't worryafter this book, you will speak ActionScript like an expert. Have paper and a pencil ready, though. It's a good idea to take notes through out the book.

If you remember correctly, the main Timeline is where all of your keyframes and tweening occurs. A Movie Clip is a type of symbol that contains another timeline within it. The button symbol is a special type of symbol that is completely interactive and has four frames on its timeline. All of these elements can be scripted.

So where do programmers type their scripts? Well, back in the old days, many separate programs were necessary to write and execute code and it was a hassle at times. Nowadays, these programs have been integrated to make a programmer's job much easier and keep all of their tools in one place, and Flash has been designed this way as well to make ActionScript easy to program with.

NOTE

NOTE

For our purposes, the words script and program can be used inter- changeably.

To sum up, ActionScript is used to control Flash animations and Flash program flow. As you already know, ActionScripts cannot run without the Flash player and it is the language that you will be using to program your games in. Let's move on.

[ LiB ]


Game Development with ActionScript
Game Development with ActionScript
ISBN: 1592001106
EAN: 2147483647
Year: 2004
Pages: 162
Authors: Lewis Moronta

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net