ActionScript: Figuring Out Where to Begin

Author of this post: David Stiller | About Blog Authors »

actionscript-start-fig1.jpg

Flash designers and Flash developers are often the same person. Why? It’s mainly because Flash has proven such a popular success and because it breathes interactive life into lightweight, great looking artwork—or, looking at it from the other side, that it spiffs up programming projects so well from a visual standpoint. The platform really serves as a blend of the disciplines of design and development, and, in light of this tendency, Jen deHaan (Adobe documentation doyenne, among other talents) has dubbed this special hybrid a Flash “deseloper,” which gives deselopers the world over an apt title. This is useful, for sure; however, the advent of Flash CS3 makes things a bit more interesting.

ActionScript 3.0 (AS3) is pretty new for most Flash deselopers. The latest edition of the ActionScript programming language is only supported by Flash Player 9 as of this writing. Obviously in the future it will be supported by Flash Player 10, 11, and so on, but Flash Player 9 is the turning point. Although AS3 is new to Flash CS3, it was available to programmers over a year ago by way of the Flex platform and its code editor, Flex Builder 2. This is the first time in the history of Flash, by the way, that the virtual machine has stepped out of synch with the authoring environment: Flex Builder 2 could publish to Flash Player 9 well before Flash CS3 was released.

So even though it’s new in a sense, AS3 already has a strong user base, though mostly in the realm of Flex developers (Flex is ultimately just another Adobe product that publishes SWF files, which is what Flash has done since the beginning, only Flex features nary a drawing tool or timeline). Most people who use Flash are probably still writing their code in ActionScript 2.0 (AS2) and even 1.0 (AS1). This leads many newcomers to an important question: they’re interested in programming, even if only to get their feet wet, but where to begin?

Should you go for the latest and learn AS3? Should you start with AS2 and work your way up? Should you even bother with AS1? Like many of the mysteries in life, this conundrum doesn’t have a single answer that suits everyone. That said, if you’re stuck at work or still in school trying to sort it all out, the following pointers should at least give you something to go on.

If your project requirements dictate that you publish to something prior to Flash Player 9, then AS3 is out of the question, plain and simple. Many ad agencies and art houses stick by policies that demand Flash Player 6, or a sliding “two versions behind the current version,” which presently means Flash Player 7. In a situation like this, I heartily recommend AS2 over AS1, simply because ActionScript 2.0 is the first version to truly emphasize the object-oriented nature of the language, and can be compiled all the way back to Flash Player 6. The benefits of object-oriented programming (OOP) are numerous, but, in a nutshell, this approach focuses just about everything you do around a concept called objects. Objects are, well, things you can manipulate in an abstract sense via the code you write. Objects are defined by something called classes, and the ActionScript 2.0 Language Reference (part of the Help docs) is closely organized around these classes, which describe an object’s properties (characteristics), methods (things it can do), and events (things it can react to). So rather than hunt and peck for what a movie clip symbol might be capable of, look up the MovieClip class and find out for sure. It’s a mini Owner’s Manual for the object at hand. If you’re dealing with text fields, look up the TextField class; if button symbols, look up the Button class, and so on.

This holds true for AS3 too, by the way, but the ActionScript 3.0 Language Reference is a considerably larger document. What makes AS3 better? Honestly, unless you’re a hardcore programmer, you’re not likely to see the touted speed improvements and many of the other features (like regular expressions) that digit-heads go nuts over. You will see a more cleanly organized API (the help Docs) and certain simplifications such as the improved event handling model. Event handling is the process by which objects are instructed on how react to things, such as mouse clicks, the completion of a sound, a loaded XML document, and the like. Between AS1 and AS2, there are no fewer than four distinct ways to respond to events, while AS3 reduces those (in most cases) to a single consistent approach.

If you’re using the newest user interface (UI) components (see the Components panel in Flash CS3), then you’ll have to use AS3, because those components are written in that language. If you want to take advantage of the new automatic video captioning component, you’ll also have to use AS3. In short, if you can use AS3, I recommend that you do. It’s where we’re all heading, sooner or later. This will largely depend on the minimum required Flash Player dictated by your project specs. Just be sure not to confuse Flash Player capabilities with language capabilities. For example, you don’t have to write in AS3 in order to use blend modes and filter effects, because those were introduced in Flash Player 8. Those work in both AS3 and AS2, and the relevant Language Reference tells you, for every given feature, what version of Flash Player was the first to support it. Many features don’t require ActionScript at all.

If your company is open to Flash Player 9, learn AS3 first and pick up AS2 when you can—because you will be using it, too, and it’s often very different. If you’re publishing to anything prior to Flash Player 9, start with AS2, stick with reference books that embrace object-oriented design (OOD) or OOP, and pick up AS3 when you can—because you will be using it at some point. AS2 has its own set of UI components and you’ll still find plenty of reference books on that version of the language.

If you’re publishing to especially old versions of Flash Player, AS1 may just be your fate. This may overlap with those of you developing for early new-generation cell phones and PDAs running Flash Lite 1.0 or 1.1. Current generation mobile devices tend to support Flash Lite 2.0 or 2.1, which again gives you AS2.

Bottom line? Acquaint yourself with the principles of OOP. The principles—treating your goals and tasks as objects—are the most important step. Particular syntax changes from one version of ActionScript to another are ultimately just dialects, and AS3 is the best organized, most elegant speaker of the lot.

Here are my recommendations for OOP-leaning reference books:

For ActionScript 1.0, go for OOP with ActionScript, by Branden Hall and Samuel Wan.

For ActionScript 2.0, consider Object-Oriented ActionScript for Flash 8, by Peter Elst and Todd Yard, and, when you’ve digested that, pick up Colin Moock’s Essential ActionScript 2.0.

For ActionScript 3.0, well, it’s still new. Flash-specific books are still being written for this language. If you’re new to Flash at all, consider Foundation Flash CS3 for Designers, which I co-authored with Tom Green. There’s a companion book still in the works, Foundation ActionScript 3.0 with Flash CS3 and Flex, by Steve Webster, Sean McSharry, and Tim Willison (due in November, 2007). In the meantime, Elst and Yard collaborated with Sas Jacobs to update their book Object-Oriented-ActionScript 3.0. Finally, Colin Moock’s new Essential ActionScript 3.0 is in my own library.

7 Responses to “ActionScript: Figuring Out Where to Begin”

  1. David Stiller’s blog » Blog Archive » ActionScript:  Figuring Out Where to Begin Says:

    [...] http://www.notesondesign.net/graphic-design/actionscript-figuring- out-where-to-begin/ [...]

  2. Sarah Says:

    I love you for this. I just started working on a quickdrop game for a class and have no idea where to begin. Thank you so much!

  3. David Stiller Says:

    Sarah,

    Thanks! Glad to hear it. :) Whatever route you take, whatever version(s) of the language, keep your chin up.

  4. mrock Says:

    Thanks for making things like this clear and for taking the time to write and explain flash at your blog site. It’s helped me get through the fork in some of my projects.

  5. David Stiller Says:

    mrock,

    You’re welcome! :) I’m happy to hear this article has been helpful to you.

  6. brianp Says:

    thanks so much david for sharing your knowledge. i’ve been attempting to acquaint myself with AS3 and have found it difficult to source instructional info (even with the purchase of a book) that doesn’t quickly become confusing. your blogs are a breath of fresh air. thanks again

  7. David Stiller Says:

    brianp,

    You’re welcome! Thanks for the encouraging words!

Leave a Reply

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Self-Help Art
July 9th, 2008
Inspiration Art