uɐʎɹ ррoʇ uɐʎɹ bio photo

uɐʎɹ ррoʇ uɐʎɹ

Hello. Is is me you're looking for?
僕は猿ーロボット。
robotic life signs.
makes noise, hears sounds, intafon.
affe auf deux roues.

Email Twitter Github Github Gist Last.fm Soundcloud Flickr

So for those of you/us that have been using Actionscript 2.0 and building projects that have gotten a bit sizable, there’s a handy little trick that I thought had been forfeited somehow when AS 2.0 came along. I’m referring to the ability to use registerClass to assign an actionscript class to a movieclip symbol being exported with a linkage id.

Using the example below, you can see that the trick is to include a private static variable in your class file that assigns that particular class (“InjectionMold” below) to the movieclip symbol (“ExportedSymbol” below) to which you would like it linked. This assigns the class for you at runtime.

[as]class com.plasticstare.InjectionMold extends MovieClip {

// BINDING private static var binding= Object.registerClass(“IMExportedSymbol”,InjectionMold);

public function InjectionMold() { // whatever here } } [/as]

The BIG advantage, however, is this — if you have attached the code class to the symbol in the library, every time you change the code, you have to re-export the movie from the Flash IDE in order to compile the code. If you have jumped on the open source band-wagon and are using Eclipse with MTASC, you can in this way edit the file in Eclipse and use your favorite method of re-compiling through MTASC to re-“publish” the movie. My development machine is a 1gHz 12″ Powerbook (I’m working on a tutorial for using Eclipse and MTASC with OSX – its not quite day in the park to set it up, but it works great once you’re there), so re-publishing from the Flash IDE can be excruciatingly slow sometimes; re-compiling using MTASC is supposedly 1000 times faster, so you can imagine the time saved during the course of a project (its almost like dividing by zero).