By Greg Ferrell » August 26, 2008

One of the most powerful idioms available in JavaScript is the anonymous function closure: e.g. (function(){})();. If you are unfamiliar with this, it simply creates an anonymous scope bubble that can be used to prevent automatic global variables, or trick JavaScript into allowing private variables. Unfortunately, this idiom isnt available in ActionScript 2.0. It simply doesnt work. (As of ActionScript 3.0, it works perfectly.)

This means that, on the surface, the only way to prevent time line variables from being constantly created is an init function of sorts. (ActionScript 2.0 has a pseudo global object which is the main time line of a movie level, and a totally global object named _global.) This also means that private variables are restricted to the creation of object classes. I personally get annoyed at times with classes in ActionScript. One of the things that has always bugged me with ActionScript 2.0 and the introduction of classes is that they are hard to make portable. (I work on no less than 3 computers in a single week, and 4-5 when on business trips, so portability is paramount to my work.) Rather than being able to simply include the classes in the same folder as the flash working file (*.fla), you must specify where on the computer the includes are. This is just annoying if you work on the file on several different computers. There are a couple of ways to avoid naming the class include folder on each computer, but they are as much of a pain as the default method. Fortunately, there is a solution.

Read Full Article...

By Greg Ferrell » May 24, 2007

At work I am making a new Flash interface for a project, and my goal this time around was to make as many global functions out of repetitive ones as possible so we could save development time.

As I began writing and testing Prototype class extensions and global functions, I noticed something I had not run into before with flash. If Import classes on one ActionScript layer, and call it on another Actions layer, or even the next frame, it produces an ActionScript error.

Read Full Article...

By Greg Ferrell » April 22, 2007

At work we use a lot of fake pop-ups in Flash to show information. Everything generally works very well, until we discovered that you can click buttons in flash that are underneath a movieclip or a graphic.

The first solution was to hard code disabling of MovieClips/buttons like so:

Read Full Article...

By Greg Ferrell » December 23, 2006

Today, I was working on a flash website for a client when I ran into an interesting problem: My Action-Scripted sounds weren't playing from a internally loaded swf.

The setup was simple:
Using Flash 8, I made a main movie that loads the interface, and when another section is clicked it loads within the main swf. I was also using the same script that I usually do for sound, which always seems to work (and is subsequently the one Adobe/Macromedia recommends).

Read Full Article...

By Greg Ferrell » December 19, 2006

At work, a colleague and I were converting a huge Director MX2004 CD lesson to a Flash 8 lesson for web delivery.

Within the Director mx 2004 lesson, there were a TON of Quicktime movies that played within the lesson. We batch changed all these into FLVs when we ran into a problem. We needed the flash time-line to advance when the video was finished.

Read Full Article...