I am creating game which involves some billiard-like balls to bounce on the screen. I created a MovieClip with only one frame which represented the ball, exported it to the class, extended it to my needs and animated it using Event.ENTER_FRAME. It works fine, but there is something that confuses me — both, the stage and the ball have only one frame each, so I don’t quite understand how Event.ENTER_FRAME works… I mean, if there are no keyframes, how is done the animation??? If I used already animated MovieClip, I would have to add keyframes, right?
I am creating game which involves some billiard-like balls to bounce on the screen.
Share
Flash Player is always playing based on a frame rate. whether display objects are actually moving depends on if those objects are listening for instructions in an Event.ENTER_FRAME event handler, often to reposition/redraw themselves, or not. think of the Event.ENTER_FRAME event as being a power outlet that can animate an object whenever you plug it in.
moving from frame scripting to real programming can be confusing in this regard. frame scripting and the MovieClip object typically are treated as a frame-by-frame sequence, at least thats what users using Flash Professional IDE are suppose to believe since it’s easy to grasp both conceptually and visually.
in Flash IDE frame scripting, it appears that you have more visual control of each frame, and while those frames can be altered individually to display a flip-book-style frame-by-frame sequence (IE: dropping a different image into each frame), they, too, can be programatically animated (IE: motion tween). programatically animated display objects don’t take up more and more frames as you might think based on the Flash IDE since those are only visual tools. the AVM2 runtime treats frame scripts and packaged code the same way.
MovieClip extends from Sprite objects. they are basically the same object, except Sprite doesn’t have functions like gotoAndStop(), etc. if you are switching to package level programming from frame scripting you should not use MovieClip objects since they are both heavier and practically useless – use Sprite instead.