ActionScript 3: Taxonomy
Mar 13th, 2008 by Leo A. Geis
Kingdom, Phylum, Class, Order, Family, Genus, Species. We’re a homeschooling family so we made a little jingle out of Linnaeus’ system, and the kids “got it.” One of the most confusing items within AS (or any ECMAScript) is the variety of terms used to describe things that seem completely unrelated to the common usage .
My intent is to provide supplemental explanations to what other PAPA members will find in Flash Help (F1) or any instructional books or websites. I’m not particularly smart-but I’m slow…I had to use a variety of descriptions to form my own understanding of the elements of ActionScript. While I can’t directly tie in the value of understanding these elements directly to aerial photography, I guarantee that if you don’t understand them your abilities in Flash will be limited to the IDE, and that’s not where we need to be.
Object: An Object is a thing. In AS, we’re dealing with things that are actually assemblies of text wrapped up between parens (“()”), brackets (“[]“), or braces (“{}”), confined to single lines, and sometimes delimited with periods (“.”), commas (“,”), colons (“:”), semicolons (“;”), spaces (” “) (joke…OK?), et. al. Those little bits of text are required to conform to a particular syntax, of course, specified by ActionScript 3. Some Objects are bits of text that prescribe action (Functions), some are lists of other Objects, some describe Properties of Objects, and some are simply output used to diagnose problems or keep track of all those Objects you’re dealing with. In your mind, abstract the term “Object” to mean “a thing.” Do you see some funny (if base) anatomical emoticon potentials with a period between parens?
Instance: An Instance is nothing more than a single, lone entity of an Object-a singularity. Think about how you would communicate with two Objects of the same type…say, your twin sons. You’d probably name them differently because they look exactly alike (unless your family has instituted some strict dress code for telling them apart), they require the same resources (the TV remote and Doritos), they behave similarly (sleeping all day and awakening only for meals), and they hemorrhage dirty laundry and candy wrappers wherever they go. To assign particular instructions for either, you name them and address them by that name. Each, although a inheritor of their parents and extremely similar in appearance, is a single “Instance.” Frankly, teenage twin boys are an exceptional analogy for explaining Instances.
Class: A Class is a description of an Object, but the Object it is describing is actually a cookie-cutter, or plan, for other Objects. A Class is a recipe, a blueprint, a jig. You use Classes to create Instances, and it’s the Instances you use to perform the duties of the application you’re writing in AS. Now, of course…it’s a tad more complicated than that. Some types of Classes can’t be Instantiated. Some parts of Classes aren’t inherited by or even available to their Instances. AS comes with a very complete collection of Classes, but you have the option (and even sometimes the obligation) to create your own “custom” Classes. At that point, you’re an AS guru and people throw rolls of hundreds at you as you walk down the street.
Package: Some Classes are recipes for graphics, like circles or squares. Other Classes are recipes for Functions. Yet others are recipes for text Objects. The list is long, and if it weren’t divided up into different folders with descriptive names to help you navigate among them, you’d be hosed. A Package is nothing more than a collection of Classes that are somehow reasonably related and organized into an appropriately named folder. The compartmentalization of various Classes has a boatload of downstream benefits that you’ll come to appreciate (and probably rely upon) as you start coding more sophisticated AS.
A list of Packages in the Flash Actions Window. The flash.display Package is highlighted.
A list of Classes in the flash.display Package. The InteractiveObject Class is highlighted.
A list of the components of the InteractiveObject Class. The Methods have been expanded and highlighted.
Interface: Interfaces are Objects that identify a set of capabilities that a Class must have in order to qualify to use the Interface (to be a “member of the club”). The Interface is then used to qualify Classes-to ensure than any Classes you specify have those particular capabilities-they are a “member of the club.” In aerial imaging it is unlikely that you will ever use an Interface, but if you don’t know what they are people will question your lineage.
Namespace: When you create a Package, you name the folder (which contains a selection of related Classes…right?) so that you have some idea what is in it and can access it using a discreet path. The folder name is functioning as a Namespace-all of the Classes in the Package are now accessed through that discreetly named folder, and if that folder’s name is not in the path, you won’t have access to the constituent Classes. Namespaces are a fairly straightforwad concept that you’ve already been using in your OS. Some Namespaces in AS limit an Object’s visibility (access by other parts of your code). In AS, the most common use of Custom Namespaces is to share the Classes between two Packages-you can specify a Namespace that includes some Classes from Package A and some Classes from Package B without having to move them around or create another Package to contain them. Namespaces are your friend.
InterCap: Also called “CamelCase,” InterCap the syntactic practice of using capital letters to identify the start of a new word or identifier when you can’t uses spaces, underscores, or other clever ways of separating things. ItWorksPrettyWellDon’tYouThink?Flash Player: Flash Player is the application on the remote computer (the viewer’s computer) that opens and runs a compiled/published Flash movie, or “.swf” file. The Flash Player has endured a great many generational reformulations over the past 300 years-in fact, most of those have occurred just in the last decade. As of this post, the current version of the Player is 9, and it’s an amazing thing. Here are the Release Notes from Adobe. Practitioners really need to keep up to serious speed on the Flash Player, whether or not they are in the IDE or API.
Adobe AIR: One of the most important elements that will create insatiable demand for your Flash products (aside from Flash Lite) is the Adobe Integrated Runtime (AIR) application. AIR will standardize the deployment of AS-built applications across all operating systems in a consistent, convenient, and reliable process. If you interpret that to mean that the current state of affairs isn’t perfectly consistent…OK. The importance of AIR in the development of AS applications for aerial imaging products cannot be overstated.
I trust my recreational explanations of these concepts helps you absorb them, but don’t get comfortable-it’s back to regimental discipline on the next post.
L





