August 25, 2008Making Anonymous Functions and Closures Work in ActionScript 2.0

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...

AddThis Social Bookmark Button Posted by Greg Ferrell at 09:35 PM. Filed under: Flash-ActionScript • (0) CommentsPermalink
May 23, 2007Import classes and Multiple ActionScript layers in Flash

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...

AddThis Social Bookmark Button Posted by Greg Ferrell at 10:11 PM. Filed under: Flash-ActionScript • (6) CommentsPermalink
May 07, 2007Moving away from the _root

When working with multiple, nested MovieClips, or dynamic variables, sometimes you need your ActionScript to refer out to other MovieClips, or the main timeline of the swf file. When I was first teaching myself ActionScript, I learned to use _root to reference outside of functions or MovieClips.

It is this point in my learning that see how wrong I was to rely on _root for every outside-the-MovieClip function.

Read Full Article...

AddThis Social Bookmark Button Posted by Greg Ferrell at 02:08 AM. Filed under: Flash-ActionScript • (0) CommentsPermalink
April 22, 2007Playing Flash FLVs without the Flash Player

Due to the rise in internet video, and the need for it to be easily played on different operatiing systems and browers, Flash FLVs have taken off in the last two years. In light of this phenomenon, I find myself more and more downloading FLV videos for later viewng.

The most common places you will see FLV video for the masses is of course YouTube and Google Video, but many more sites are catching on. Flash has 98% browser penetration, and works on Mac, PC, and Linux, so it is a no brainer.

Read Full Article...

AddThis Social Bookmark Button Posted by Greg Ferrell at 06:12 PM. Filed under: Flash-ActionScript • (2) CommentsPermalink
April 22, 2007Disable “Click-Through” on MovieClips in Flash

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...

AddThis Social Bookmark Button Posted by Greg Ferrell at 02:48 AM. Filed under: Flash-ActionScript • (6) CommentsPermalink
February 03, 2007A “Simple” Tester for Flash Tweens

Recently, I built a flash website for a customer that required a lot of small, smooth tweens. I have used ActionScript tweening before, but not enough that I knew all of it from memory, so I went about my business experimenting with them. I realized that this situation might come up again, so rather than creating a dummy file every single time, I made a small tween tester app that would give me the code and remind me of how to use it.

I included the full instructions from the flash help file as well as some on how to use the tester. This way, i can simply see how a tween/transition is going to look without even opening flash. It has been a real time saver already.

Read Full Article...

AddThis Social Bookmark Button Posted by Greg Ferrell at 07:21 PM. Filed under: Flash-ActionScript • (0) CommentsPermalink
December 22, 2006Exported audio won’t load from a loaded movie in Flash 8.

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.

Like so:

Read Full Article...

AddThis Social Bookmark Button Posted by Greg Ferrell at 09:48 PM. Filed under: Flash-ActionScript • (2) CommentsPermalink
December 19, 2006Actionscript function on FLV finish without quepoints

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...

AddThis Social Bookmark Button Posted by Greg Ferrell at 04:45 PM. Filed under: Flash-ActionScript • (6) CommentsPermalink

Page 1 of 1 pages