I have a movieclip that has a keyframe at every frame, and I’d like my code to be able to draw to the individual keyframes within that clip. I’m generating images for animation, but the code takes a few seconds per image, so the animation can’t simply be generated on the fly. I want the code to draw all of the images into the movieclip and then play the animation as a loop once that’s done.
It seems like this would be a pretty straighforward method, but I can’t get it to work. It seems that when I draw into the movieClip, it ignores the fact that I have keyframes there. Whatever I draw appears at every frame as if it’s drawn onto a different layer that just has the default keyframe at frame 1.
To test, I manually put drawings into the keyframes, and they loop back as expected. The only problem seems to be that the animation images generated by actionScript appear all on top of each other and held for the entire movieClip loop.
The following is code that I had hoped would draw into frame 2 of the movieClip. I assume that this is naive:
clipInstance.gotoAndStop(2);
clipInstance.lineStyle(1, 0x000000);
clipInstance.beginFill(0xFFFF00);
clipInstance.moveTo(minX, minY);
clipInstance.lineTo(minX, maxY);
clipInstance.lineTo(maxX, maxY);
clipInstance.lineTo(maxX, minY);
clipInstance.lineTo(minX, minY);
clipInstance.endFill();