Welcome to the companion website for Learning ActionScript 3.0 (O’Reilly). Ideally, you have found your way here after acquiring a copy of the book, and you are looking for further information about material referenced therein. If you’re new to this site, please continue reading. If you are a veteran to these pages, thanks for coming back, and have fun exploring.
Welcome
TweenLite Introduction
One of my favorite things to do in Flash is to program different types of motion. From particle systems to the boss at the end of an advergame—the basic principles for moving things around the screen with code are the same. There was a time when all the different types of motion that I saw happening—back in the Flash 4 days—were a complete mystery to me. I remember spending a long time reverse engineering open source examples from ultrashock.com.
Motion Myth
For some reason lots of people seem to think that ActionScript animation creates smoother animation than the Flash timeline. This is simply not true. The timeline is just as capable of creating “smooth” animations as ActionScript is.
On the timeline, if you want a smoother animation, use a framerate around 30fps and put more space between your keyframes.
ActionScript vs. Timeline
Students sometimes ask me when to use coded animation and when to use timeline animation. The answer is more complicated than you might expect. Here’s a basic set of rules:
TIMELINE ANIMATION IS FOR:
- animation that is always the same (static animation)
ACTIONSCRIPT ANIMATION IS FOR:
- interactive animation
- random animation
- animation driven from an outside source like an rss feed
- complex, static physics simulations that would be hard to animate on the timeline
- complex interactive physics simulation
- time-based animation—that is, animation that always runs at the same speed independent of framerate
I like to make my custom UI elements easy to skin. If we wanted to create a check box class that was easy to skin, one thing we could do is create an FLA based AS3 component. Unfortunately to do that takes advanced programming skills. If you’re an intermediate programmer you might want to be able to create a skinnable UI element without all of the AS3 component architecture.
One way to achieve this is by creating a custom class that uses Library elements as assets. To increase flexibility (for swapping skins, for example), you can create each graphical element of your check box, store them in your Library, assign a linkage class name to each element, and then pass those linkage class names into your custom class.
Grids: Arranging Clips
It’s extremely common to need to position display objects in a grid formation. I usually find myself doing it when displaying thumbnails for an image gallery. This post will take you through the process step by step.
Understanding the basic display object properties like x, y, width, height etc… is imperative for anyone interested in intermediate level ActionScript. It’s important to practice using properties until you understand them well enough to solve problems using them. If you’re not comfortable with properties yet, you should read through Chapter 3 and then try the exercises in the Property Practice (simple motion) post.
AS3 Teachers Wanted
If you are a teacher or trainer currently using Learning ActionScript 3.0 in a class, please get in touch. We are developing additional teaching resources and are anxious to know what you think would help you most. What are the strengths and weaknesses of the book? What tools will help you in your teaching? Any opinions will be appreciated!
If you’re a student using Learning ActionScript 3.0 in a class, please let us know what kinds of class resources you think would be useful, and tell your instructor we’re looking for input!
We’re very happy to announce that I’ll be conducting a workshop on ActionScript 3.0 at this year’s Flashbelt conference in Minneapolis. It’s a full-day workshop based on the book, teaching the fundamentals of AS3 with lots of examples and, of course, free source code.
This will be my first time at Flashbelt, and I’m really looking forward to it. I’ve heard very high praise about the show—praise that grows year over year—and I dig Flashbelt’s El Hefe, Dave Schroeder. In addition to putting together Flashbelt, Dave is also the brains and talent behind Pilotvibe, a groovy place to get you some Flash sound.
From everything I’ve heard, Flashbelt is a happenin’ gig, that has an intimate feel and a stellar group of presenters. This year is no exception. Presenters include Mark Anders, Julian Dolce, JR Fabito, Richard Galvan, Moses Gunesch, Joshua Hirsch, Robert Hodgin, Mario Klingemann, Tali Krakowsky, Dan Lacivita, Lisa Larson-Kelley, Seb Lee-Delisle, Andre Michelle, Stacey Mulcahy, Erik Natzke, Paul Ortchanian, Danny Patterson, Todd Perkins, Robert Reinhardt, Rich Shupe, Geoff Stearns, Mate Steinforth, Zach Stepek, Craig Swann, Jared Tarbell, Dustin Tauer, Jeremy Thorp, and Philip Van Allen.
This year, the event is June 8-11, and I hope to see you there.
Having a good grasp of the basic properties of display objects is extremely important for anyone interested in intermediate level ActionScript. This post assumes that you’ve taken the time to read through Chapter 3. If you’re new to ActionScript, it will likely help with this post if you read up to Chapter 7.
This post contains a few short exercises that will put your knowledge of properties to the test.
As a guide, here are the properties that you will need to be familiar with:
x y scaleX scaleY height width rotation
For each example you’ll need to use the properties in conjunction with an enterFrame event:
addEventListener(Event.ENTER_FRAME, onLoop, false, 0, true);
function onLoop(evt:Event):void {
// change properties over time
}
AS3 Components and TxEff
Recently I’ve been trying to put together a collection of AS3 components for some writing and training I’m doing about… er… AS3 components. I want to write a series of posts here, but I also have another column, book, and video training in the works, in which they may appear. With a fair amount of focus on this effort, I wanted to look around for some great examples, ranging from open source to commercial, simple to advanced.
In the process, I happened upon TxEff from Jumpeye Components. TxEff is a spectacular text-effects component with a really great configuration utility that allows you to easily modify all the effects without writing any code. You can also configure the effects without the utility using XML. Written in AS3, it performs really well and Jumpeye did a great job, soup to nuts. You can even add on to the component with additional effects.
I haven’t been able to try any of the additional effect libraries, but I decided to try a simple test that fits in well with the first post in this series. I wanted to see how easy it would be to create a simple effect using the online utility. I wanted to create something that anyone could do, right out o the box. I was pretty impressed with how easy it was to adjust the many parameters and found myself with the problem of too much goodness to choose from. Then I decided to test the defaults of one of the new effects, 3DCamFocus. Here it is:
Over the past two weeks I’ve taught two different lessons covering the basic ins and outs of the Graphics class (Drawing API). Something I noticed is that it’s not always immediately apparent when you’re starting out that the clear() method can be used to animate dynamically drawn vector graphics. That is, in both my class demos I introduced clear() by using it to erase a canvas when a button was clicked. When I described the idea of continuously clearing and redrawing graphics to create an animation there was some confusion, so I created a simple demo on the fly:
addEventListener(Event.ENTER_FRAME, onLoop, false, 0, true);
function onLoop(evt:Event):void {
graphics.clear();
graphics.lineStyle(1,0x000000);
graphics.moveTo(100,100);
graphics.lineTo(mouseX, mouseY);
}
Copy this into your timeline if you’re not sure what it does.


(18 votes, average: 4.33 out of 5)
(8 votes, average: 4 out of 5) 


