# MovieClip subclass troubles with MovieClip events

**URL:** <https://forum.kirupa.com/t/movieclip-subclass-troubles-with-movieclip-events/194316>\
**Category:** flash\
**Created:** [July 22, 2006, 3:45am UTC](https://forum.kirupa.com/t/movieclip-subclass-troubles-with-movieclip-events/194316 "2006-07-22T03:45:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jwopitz](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/jwopitz/32/1556_2.png) [@jwopitz](https://forum.kirupa.com/u/jwopitz)\
**Post date:** [July 22, 2006, 3:45am UTC](https://forum.kirupa.com/t/movieclip-subclass-troubles-with-movieclip-events/194316/1 "2006-07-22T03:45:51Z")

</div>

I have a custom class that extends the MovieClip class. The library linked mc, is an empty mc. The class uses the drawing API to create the visual content on the stage.

I am having issues defining MovieClip events. The constructor looks like:

```auto

public function Shape (target_mc:MovieClip, depth:Number, paramObj:Object) {
        name = Type + "_" + depth;
        __mc = this;
        __mc = target_mc.attachMovie ("Shape", name, depth);
       //do drawing API stuff with paramObj
}

```

then on the stage I am trying to do this:

```auto

var s:Shape = new Shape (some_mc, someDepth, {...});
s.onRelease = function () {
   trace ("released");
}

```

So I am not sure how to proceed. I was thinking about using a decorator pattern to somehow define the mc events, but I would assume there is something super simple that I am overlooking.

Any help is much appreciated. Thank you.
