# Extending the MovieClip class

Using ActionScript 2 and object-oriented programming techniques, you can extend the behavior of the default MovieClip class. For more information about ActionScript 2 see Creating classes with ActionScript 2.

To extend, or subclass, the MovieClip class, you use the `extends` statement to specify MovieClip as the superclass of your custom class. The example code shown below create a subclass called Ball of the MovieClip object. This class overrides the `MovieClip.onEnterFrame()` method to move the clip (that this the class is applied to) five pixels to the right at each new frame.

    // Ball class -- moves symbol to the right five pixels every frame

    class Ball extends MovieClip {

    	function onEnterFrame() {
    		_x += 5;
    	}
    }