# Extending MovieClip

**URL:** <https://forum.kirupa.com/t/extending-movieclip/53769>\
**Category:** Uncategorized\
**Created:** [June 7, 2004, 7:11pm UTC](https://forum.kirupa.com/t/extending-movieclip/53769 "2004-06-07T19:11:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sbeener](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/sbeener/32/75_2.png) [@sbeener](https://forum.kirupa.com/u/sbeener)\
**Post date:** [June 7, 2004, 7:11pm UTC](https://forum.kirupa.com/t/extending-movieclip/53769/1 "2004-06-07T19:11:17Z")

</div>

i’m trying out AS2.0 for the first time (yes, i’m behind… sigh) and i’m running into a problem with extending MovieClip.

in 1.0, i’m a big fan of dave yang’s setClass function, i would write a class and always include a MovieClip.prototype.create[ClassName] function so i could use it just as you would createEmptyMovieClip.

this was great because it let me place a movie clip on the stage, of whatever class i’d written.

```auto

function Grid(){
	//grid stuff
}

Grid.prototype. __proto__ = MovieClip.prototype;

MovieClip.prototype.createGrid(name,level){
	var g = this.createEmptyMovieClip(name,level);
	g.setClass(Grid);
	return g;
}

```

then i can go:

\_root.someClip.createGrid(‘myGrid’,0);

and voila, a grid is created in someClip.

with 2.0, i’d like to use the new syntax, but still want to be able to place a clip on the stage of whatever class.

i’ve tried associating a clip which i create manually with the class, but that’s messy and creates 2 objects where i feel only 1 is necessary.

like this…

```auto

class Grid extends MovieClip {
	private var _rows;
	private var _cols;
	private var _mc;
	
	function Grid(rows:Number, cols:Number, parentClip:MovieClip, name:String, level:Number){
		_rows = rows;
		_cols = cols;
		_mc = parentClip.createEmtpyMovieClip(name,level);
	}
}

```

so \_mc is a reference to a clip somewhere that the Grid instance would control.

is there a way to make

\_root.someClip.myGrid = new Grid(args);

create a clip in \_root.someClip named myGrid of class Grid?

or can i integrate AS2.0 into my comfortable old way and still reap the benefits (there are benefits, right?) of the new player?
