Let's suppose we have a spinning star. The code would be
this.addEventListener(Event.ENTER_FRAME,frames);
function frames(e:Event):void {
star.rotation=star.rotation+1;
} //frames
Now, if we want to have 3 spinning stars, we would name them, star1, star2 and star3. The code would be:
this.addEventListener(Event.ENTER_FRAME,frames);
function frames(e:Event):void {
star1.rotation=star1.rotation+1;
star2.rotation=star2.rotation+1;
star3.rotation=star3.rotation+1;
} //frames
A movie like the one above, or one with 100 stars would be a lot of work! Fortunately, there is a much easier way: create some code for a Spinner, then just say that each of the stars is a Spinner. The code that describes what a Spinner is is called a class. Each star is an instance of the Spinner Class and will spin automatically.
Terminology:
Note: Every MovieClip we create extends the basic MovieClip. All movieclips have the properties x, y, width, height and more. They have the methods play() and stop(). They have functions like totalFrames and current frames.