
Adobe has been ever so gracious to grace us with the Open Source Flex SDK (we’re up to Flex 3 SDK at time of writing). This means that us actionscripters can compile/build our flash projects without using the Flash CS3 Software. In other words, a programmer can add a bit-o-elbow grease to the mix, take advantage of the awesome Open Source community out there, avoid the $200 upgrade or $500-600 dollar price tag of Flash CS3, and still create spectacular (or basic) flash applications. Wow!
My goal in this article is to quickly orient you to my, albeit primitive, understanding of how to set up a development environment for programming in AS3. Simultaneously, I hope to uncover the mystery of how this is even possible and I’d like to do it in layman’s terms (the only kinds I know). I’ve temporarily settled on this particular set up after hours and days of research, and trial & error, and exhaustion. Please, feel free to use this article as a springboard, for research, and/or just as a general introduction to openSource AS3 programming. Certainly, this approach can be improved upon, as I am anything but a computer science expert. Also, make sure to read the warnings section (below) before delving blindly into and relying on an open source flash setup.
INTRO:
So, I never use and never have used Flex, but the compiling engine (the opensource version is Flex SDK) is the key ingredient to openSource flash. Flex is simply another Adobe software/environment for creating *.swf files. The Flex compiling engine recognizes the Flex language (mxml–an actionscript markup language) and straight actionscript. So now, with Flex SDK, we have an opensource compiler that can read actionscript 3.0 and output a *.swf file. Sweet!
WARNINGS:
Realize that you’re giving up things by giving up the Flash software. This is me getting high off of disclaimers:
W/o the software, say goodbye to timelines. Sad. But, really, this is good for you. Timelines only made your code messy. Pure actionscript applications are often cleaner, more streamlined and thus faster. And you still have powerful animation tools at your disposal. If you do all or most of your work with timelines, then expect to be challenged. Using an open source development is mostly synonymous with code-only applications.
W/o Flash CS3, you won’t receive any included classes or new components or whatever is in that bundle. Instead, you get what’s included with the free Flex 3 SDK bundle (similar to but different than the flash bundle–A complete list of the Flex packages of classes here. I’m not aware of how to use or get access to the components in the bundle, as I have never used Flex components). Note: The fact that certain flash packages aren’t supported by Flex was important to me because I relied heavily on the fl.transitions.tween class to animate all my AS2 crap and it apparently is not supported by Flex.
In addition, be aware that AS3 applications use an overhauled actionscript language and thus it doesn’t support many AS2 conventions. Flash Player 9 claims backwards compatibility, but it isn’t as backwards compatible as you’d like. (From page 26 of Adobe’s Guide to AS3.) This is more a warning about AS2 to AS3 migration, not necessarily about setting up the open source environment, but it’s worth mentioning. And consequently, it’s probably wise to try a strictly AS3 project before migrating an AS2 project to AS3.
Be aware that, without the Flash Software, there is no Flash library. I only use the flash library for fonts, so this isn’t a giant issue for me and apparently, there’s a workaround. I haven’t gotten that far, though.
Finally, and probably most importantly, I haven’t figured out how to reintegrate the trace function. Many of the set ups that I found out there use a separate debugging/logging class instead of a trace function to accomplish what trace accomplishes in Flash software. In addition, these setups require running a second *.swf while testing your main.swf in order to catch the debugging messages. I may have to settle on that solution, but it seems like too many programs and too much extra-ness. Trace is fully supported in FlashDevelop. I hadn’t completely un-installed my Flash Player before installing the Flash Player 9 Debugger version (see below)
Oh, and the most obvious warning: Using AS3 in flex, flash, or an open source environment innately means that you and user/visitors of your AS3 application must have Flash Player 9 or higher. You actually should have the Flash Player 9 debugger version.
So all that said, AS3 is a much more intuitive, genuine programming language than AS2. It runs quicker (something like up to 10x quicker) in Player 9 than AS2 does in Player 8. It also has added functionality like true Fullscreen, etc.
BASIC SETUP / BASIC HELLO WORLD:
The basic setup is pretty ideal and pretty customizable.
Install: Flex 3 SDK to your C:\ directory. (Adobe’s Flex 3 SDK)
Install: Favorite text editor, I’ll be using FlashDevelop b/c it has AS3 code-hinting and has built in compilation capabilities. (FlashDevelop)
Uninstall: Flash Player, using the Adobe uninstaller (Adobe Uninstaller)*
Install: Flash Player 9 Debugger version (Flash Player Debugger Version)*
*These are key. An added complication to not completely un-installing previous versions of the Flash Player can arise if you used Flash 8. Make sure to delete and update the player included in that installation. (in my setup, it was at this location C:\Program Files\Macromedia\Flash 8\Players\ )
Open FD and start a new AS3 Default project. Name it “test” and choose a location. Click ok. This automatically makes a folder for “test” which includes a “src” and “bin” folder which are respectively in and out folders. FD also makes a “main.as” class in the “src” folder.
Instead of centering your actionscript application around a main.fla file and importing your classes, center your application around a main class (main.as) file. This will be your document class–a concept new in AS3. FD already types out the doc class for you (below). Simply add a “Hello World” to test.
Doc Class Example (in lieu of Main.fla):
package
{
import flash.display.Sprite;
public class Main extends Sprite
{
public function Main():void
{
//ENTRY POINT TO APPLICATION
trace("Hello world");
}
}
}
SCREEN SHOT OF FLASHDEVELOP:

To compile the site, Project>Test Movie or f5 or click the test button. Make sure “Debug” is selected in order to receive trace messages in the output panel.
ALTERNATIVE: If things aren’t set up appropriately in FD, you may want to compile the straight forward way: You simply drag and drop your document class onto the mxmlc.exe included in your Flex SDK bundle (C:\Flex sdk\bin\mxmlc.exe). This will generate a *.swf in the directory where the document class is saved (i.e. in the “src” folder of your “test” project).
When you compile your application, the Flex SDK will set the *.swf to automatically run the constructor for the document class. It’s nearly the same as using the Flash Software, but cleaner. Done and done.
From here, have at it!
Of course, make sure to complete the assignments below (especially the movies) and send me feedback.
RESOURCES AND SUCH:
SUPPORT (kinda :O) and LINKS:
Open Source Flash - http://osflash.org/
Awesome resource! Good luck finding what you need if you’re a novice :O(
Flex SDK Documentation - http://opensource.adobe.com/wiki/display/flexsdk/Developer+Documentation
Not really that in depth, let me warn you.
Flex Language Reference - http://livedocs.adobe.com/flex/3/langref/index.html
Migrating AS2 to AS3 - http://www.mandalatv.net/fcny/
Awesome for a quick check at how the two compare/contrast.
Getting Started w/ AS3 (w/o Learning Flex) - http://www.senocular.com/flash/tutorials/as3withmxmlc/
Repeats some of what’s in this article, but w/ better credentials.
Adobe’s Guide to AS3(pdf) - http://livedocs.adobe.com/flash/9.0/main/flash_as3_programming.pdf
An all-around guide to object-oriented programming using actionscript 3.0
Adobe’s AS2-AS3 Migration Reference - http://livedocs.adobe.com/flex/3/langref/migration.html
Suggested reading (in no particular order):
- Foundation Actionscript 3.0 Animation: Making things move! - By Keith Peters
- Essential Actionscript 3.0 - By Colin Moock
- The Holy Bible, especially Mark 3:1415 - By God
Suggested viewings (reverse order):
- Revolution OS (history of Linux/Open Source documentary,86m) - Instant viewing on NetFlix
- Hackers - Pretty much the worst movie ever made, so it deserves a re-visit!