Tutorials, extensions, and source files for ActionScript, Flash, and other Adobe products.


Making the leap from AS3 to AS2

Posted September 15, 2009 by senocular

I recently ported (most of) a small to medium sized Flash-based application from ActionScript 3.0 to ActionScript 2.0 - yes, that's going down not up - and I thought I'd share some insight gained from that experience.

AS3 Language Reference Shortcuts ("Go" URLs)

Posted August 20, 2009 by senocular

For the longest time I've been using a "go" URL to quickly access the Flex ActionScript 3.0 language reference:
This is a redirect for:
... or whatever is the most up-to-date language reference for Flex currently. Only today did I discover there's one for the Flash CS4 (or most up-to-date version of the Flash authoring tool) language reference. And that URL is?:
That's right, the same thing in lowercase! This is, currently, a redirect for:

AS3: E4X For Display Lists

Posted August 17, 2009 by senocular

Here's a little fun project I did to recreate E4X (ECMAScript for XML) in the context of display objects and display lists. Three classes are involved (technically 2 classes and 1 namespace); E4DisplayList, E4DisplayObject, and e4d_internal. E4DisplayList and E4DisplayObject mirror XMLList and XML respectively with the e4d_internal namespace providing a place where those objects' members are stored. Here's an example:

Watch your Flash Player-HTML allow* Params

Posted July 22, 2009 by senocular

I noticed an interesting consequence of having an incorrectly defined allowNetworking HTML parameter for one of my Flash projects: Full screen stopped working in IE.

The problem was that I gave the allowNetworking parameter a value of "always". Sadly, this is not an allowed value. For some reason, because it was not recognized, on Internet Explorer it meant full screen also broke.

The lesson here is that you need to watch your allow* parameters (i.e. allowFullScreen, allowNetworking, and allowScriptAccess). Each have their own set of allowed values which are unrelated to the other.
  • allowFullScreen: [true | false]
  • allowNetworking: [all | internal | none]
  • allowScriptAccess: [always | sameDomain | never]

My problem was mistaking allowNetworking values with those of allowScriptAccess. Silly me.

Flash CS4 External Libraries with Symbol Classes

Posted July 21, 2009 by senocular

If you haven't noticed, Flash CS4 Professional now supports the use of an External Library Path to reference class definitions in SWC files to be used, but not compiled, in your resulting SWF. What this means is that you can make "child" SWFs that are intended to be loaded into another "parent" SWF and have all, or most, of the class definitions limited to the parent SWF. This reduces the redundancy of those classes in each of the children saving you on bandwidth. Right now, however, Flash has a small problem when using such classes with library symbols.

Extra First Line in a Multi-lined TextField (Flash Pro)

Posted June 23, 2009 by senocular

Part two of things I didn't know... And this has been something that has bugged me for years.

Have you ever added text through ActionScript to a multi-lined text field created in Flash Professional (Flash Authoring) and frustratingly found that the text immediately starts one line below where you think it should? Me too! Thankfully glosrfc pointed out to me why that is...

On-stage Bitmap Instances in Flash Professional

Posted June 19, 2009 by senocular

It's not often I run across something I didn't know as simple as this. In fact I'm a little embarrassed that I didn't know this, but it gives me comfort that some other people I talked to also didn't know.

What is this of which I speak? Well it may or may not be fairly common knowledge that normally, when you place a bitmap from your library onto the workarea (a.k.a. "the stage" though technically, it's never really the stage, at least not the same stage ActionScript refers to) in the Flash Professional authoring tool, that bitmap becomes a shape, or a part of a shape consisting of other bitmap or vector graphics within the same layer or z-ordering group, once you publish your SWF. A quick test will reveal this behavior:
  1. Create a new Fla
  2. File > Import > Import to Stage...
  3. Add the following frame script:
  4. Test movie

[object Shape]

If you didn't already know that, that's interesting enough. How then, you may ask, do you get an actual Bitmap instance on the stage in Flash? Until yesterday, I thought you couldn't except through ActionScript. But it turns out that is not true. Bitmap objects on the stage will become Bitmap instances rather than shapes if that bitmap image is exported for ActionScript (via library item properties).
Edit the image imported in the above example to be exported for ActionScript and run again to get the following:
[object Bitmap]

In other words, that image on the timeline has become a true bitmap instance rather than part of a shape. The Flash GUI still doesn't give you options for things like instance names or anything at this point, but the object available in the display list is in fact a true Bitmap.

Disabling Flash Player (Debugger) Error Dialogs

Posted June 15, 2009 by senocular

If you're a Flash/Flex developer, you've likely seen those Flash Player error dialogs resulting from unhandled ActionScript errors.

Flash Player Error Dialog

These appear when you have the debugger version of Flash Player installed and you run a SWF with errors in the code that are not handled correctly, either through appropriate logic, try..catch blocks, or the correct event listeners. But what if you don't want them?

Flaky Flex Builder Selections

Posted June 12, 2009 by senocular

Have you ever been making a code selection in Flex builder and suddenly the selection resets itself, starting over again from the current position of the mouse?

This has been KILLING me. But apparently not many people have seen this? Either that or they don't seem to be vocal about it. Well, now's your chance, there's a bug logged about it (thank you Tim) here:

So if you've experienced this, vote for the bug to help get rid of it!

I Lied - Array Iteration Order

Posted May 05, 2009 by senocular

Ok, I didn't necessarily "lie" per se, but I did leave out some vital information in one of my ActionScript 3.0 tips of the day, for..in and for each..in. There I claimed that ActionScript 3.0 "maintains array element order (using numeric array indices) when using for..in and for each..in". But does it?