Building a Better Timeline

I’m a programmer. And I like working in Flash. The timeline is an integral part of Flash, and I hate it. I don’t like touching anything in the development environment, ever.

So I wrote one in Actionscript. It was surprisingly simple.

 // this goes in an external actionscript file
 var frameCounter = 0;
 // position in the timeline
 var loopSize = 200;
 // length of the timeline
 this.onEnterFrame = function() {
 switch(frameCounter) {
 case 1: // something which happens on frame 1
 break;
 case 9: // something which happens on frame 9
 break;
 case 42: // something which happens on frame 42
 break;
 }
 frameCounter = (frameCounter+1) % loopSize;
 }

…and that is all there is to it. The only frames I have to worry about are the ones in which something actually happens. No filler necessary. No more digging through dozens of layers spread across hundreds of frames for a mis-typed variable.

And I did it myyyyyyyy wayyyyyyyyyyyyy!!!!!!

Leave a Reply

Your email address will not be published. Required fields are marked *