What The Hell, Flash? Ep 2: When frame action gets inherited

Here we go again.

My work flow of doing Flash animation is to tween stuff in a MovieClip and use labels + gotoAndPlay() calls to switch between animations. Nowadays, with the switch to AS3, most of the animation controls are done via external script files, so the MovieClips in my library are now mostly devoid of any frame based actionscript (a very old leftover technique from like the Flash 4 days)… except that I still use frame actions for very simple looping calls (gotoAndPlay(“anim1”) at the last frame of the anim1 animation frames, for example).

I guess the title of this post is a pretty big spoiler, but I’m surprised I didn’t encounter this problem until now. Usually if a series of animations shares the same animation control scripts (say, guy1, guy2, and guy3 all have different animations but are handled the same way), I’d have a common class that the animations would inherit from (Guy1 extends GuyAnim, Guy2 extends GuyAnim, etc). Only this time, I got lazy… I have a few animations inheriting from the first of its archetype, which contains all the control scripts (so Guy2 now extends Guy1, and Guy3 also extends Guy1…)

Imagine my surprise when the animations start glitching like no tomorrow. I guess getting a strange “invalid function override” warning when I place frame scripts on certain frames should have warned me to something, but it’s just one of those quirky things where intention don’t match behavior. I have two timelines with one set of animations in one clip and another set of animations in another clip. I have two script files (that doesn’t contain any of the frame script) where one inherits the other. In appearance, nothing overlaps, but somehow the frame scripts are probably attached to the class objects during compile time, and the result is a total animation glitchy mess.

There are times when actionscript can accommodate the strangest, anachronistic workflows between multiple versions of Flash and still somehow make it all work. Then other times… well, this happens. Oh Flash, how I learned to hate to love you.

Leave a Reply

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