Skip to content

Ecce Signum

Immanentize the Empathy

  • Home
  • About Me
  • Published Works and Literary Matters
  • Indexes
  • Laboratory
  • Notebooks
  • RSS Feed

Building a Better Timeline

2004-02-17 John Winkelman

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!!!!!!

Posted in Programming

Post navigation

Notes on Artificial Life
Demolition

Leave a Reply Cancel reply

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

Personal website of
John Winkelman

John Winkelman in closeup

Archives

Categories

Posts By Month

February 2004
S M T W T F S
1234567
891011121314
15161718192021
22232425262728
29  
« Jan   Mar »

Links of Note

Reading, Writing
Tor.com
Locus Online
The Believer
File 770
IWSG

Watching, Listening
Writing Excuses Podcast
Our Opinions Are Correct
The Naropa Poetics Audio Archive

News, Politics, Economics
Naked Capitalism
Crooked Timber

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org

© 2025 Ecce Signum

Proudly powered by WordPress | Theme: x-blog by wpthemespace.com