How to Code ActionScript 3 (AS3) | Interactive Designer - Nicholas Dunbar
Last Updated on Saturday, 16 January 2010 00:01 Written by Nicholas Dunbar

NICHOLAS G DUNBAR
ON
INTERACTIVE DESIGN
This site is here for the
following subjects:
Adobe Flash,
ActionScript 3.0 (AS3),
User Interface (UI) Design,Debugging Flash Code,
FireFlash FireFox Add-on,
Internet Business,
& Tech Ideas.
Looking for a Flash Guru? Hire Flash Consultant Nicholas Dunbar.
Articles Published:
Firebug for Flash Released!
Firebug is such a usefull tool for building JavaScript Applications. But what if you are using JavaScript with ActionScript 3 and the code in the web page is dependant on the AS3 code? The solution is FireFlash a plug-in/Add-on that extends Firebug to show console messages from both Flash and JavaScript. Download the code and mozilla Add-on at the following link. Debugging Flash ActionScript Code From The Web Browser.
This is really a subject I know from all sides. I find that it is hard to find a solid standards document out there for Flash CS3. With ActionScript 3 (AS3) people have resorted to just using Java style guides. But this is a mistake, ActionScript is not Java. It is a Java like language which is built to complement the Flash graphics authoring technology. This requires a different set of considerations. As an interactive designer I have managed teams where standardized coding practices and asset management was critical. I explore these considerations in my article about How to code actionscript using best practices and style for Flash and AS3.
Function with a rest operator (...) that calls its self
I love that rest operator (...) it makes my functions so versitile, but what if you want to use recursion? Parameters go into the function call and come out as an Array so how do you move that Array back to a set of parameters so that the function can call its self. Here is how to have a function that uses the rest operator to call its self in a recursive fashion.
Compiler Scalability
What is compiler scalability? Most Flash developers are web designers who rarely build large web applications, but every once and a while they find that they need to build a site where lots of SWFs talk to each other. Because these SWFs talk to each other they often share many classes. When the developer changes a class he has to republish/compile all the SWFs that contain that class. If his project is big it can take any where between 10 seconds to 10 minutes to recompile the project. Even if it takes 10 seconds a developer can recompile 300+ times a day while working on a project. That ends up being 50 minutes a day wasted on watching the republish bar. Thus it is important to set up walls between each SWF so that you can minimize how often you have to recompile the whole project. The first thing to do is to build a wall between SWFs. The second thing is to make sure these walls are organized in a way that you know what to recompile when you change it.
Interactive Design For The Internet
There is interactive design for console games, industrial SCADA systems, jet cockpits and much more in the computer world. Each user context provides a different set of rules for user interface design. At the dawn of the web application interactive designers need to change the way they think about UI design when building applications that live in a webpage on the internet. In this article I explore user interface design in the context of a web page.
Getting Started With The Fl Package, Where The Blazes is It?
Flash Developers who do not use Flex seem to have been left in the dust. If you are not that deep into Flash and only use the Flash authoring tool but you want to build our own components on the code that standard flash components are built or examine the code to better understand standard flash components and how they work? Where do we find this fl package code? How do we access these classes in a precompiled SWF?
How To Code AS3 To Drill Down Through XML Using Recursion and E4X?
E4X has rendered xml access much easier, but its nuances are vast and take time to learn and until you learn E4X basics it will continue to look as cryptic as Perl Regular Expressions. Here is a few functions to help you parse the XML using recursion.
Code For a Resizable and Dragable Window
I can't find any reusable code for creating a dragable window without a bunch of other functionality attached to the code that I don't need. So here it is a free bare bones example of a window that can be resized the same as your desktop windows in Flash with out all the other stuff.
How To Embed Variables in Your XML Declarations
It is slow to use a string to encode variables into your XML. In some cases faster to code and faster to proccess. Here is how to hard code XML but populate it with variables.
_global in AS3?
Many programmers from the old AS2 days miss the _global object. This object was very useful but at the same time massively abused. Still for those of you who are just trying to get by in AS3 and still get the job done as quickly as possible here is how to code the _global in AS3 through the use of a global singleton.
Get Today's Date
Sometimes the ActionScript documentation surprises me in how it can be so thurow but lack some of the most basic information. Here is a little article on how to get today's date.
A PHP Title Case Function That Uses Real Grammar
Programmers know little about writting and grammar, if you have any doubts just look at my spelling. But I do know that title case does not mean Capitalize Every Letter At The Begining Of Each Word In A Title, so I devised a function that uses grammar and provides a space to add exceptions to the rules.
Flash Paper Version 2 Customization
What a great technology, Flash Paper was a competitor to Adobe Acrobat, until Macromedia was purchased by Adobe. The Flash Player was smaller than Adobe Acrobat reader and could create smaller documents. Though Flash Paper had less functionality it provided the basics needed for most documents. It was so good that it has not gone away to this day even though the increasing size of bandwidth is making the bloated Adobe Acrobat Viewer seem sleeker all the time, lets face it Flash Paper still starts up out of a web page must faster. For those of you who still use Flash Paper check out my article on how to code actionscript for customizing Flash Paper 2 to your hearts content using ActionScript 2 (AS2).
Code for Parsing Useful Debug Info from a Stack Trace
What do you do if you want to get the name of the function where the code is currently running. If you are running multiple SWFs in one webpage and you want to know which comes from what FLA. I Provide a function to help you parse out all this information from a stack trace to improve your debuging. How to get the class name and function name of the callee function.
Code a Tree Menu Using Open Source Code.
If you want to customize the yahoo! astra tree component, here is a great example of how to begin extending its functionality. This is also a great way to get ahold of a free tree menu component.
Internet Activisim Guerilla Warfare.
Small errors that I couldn't find solutions to in my searches:
why won't that mySql query work when I uses spaces in the table name?
More to come....

