# Extending movieclip class and assigning dynamically to a class

**URL:** <https://forum.kirupa.com/t/extending-movieclip-class-and-assigning-dynamically-to-a-class/278445>\
**Category:** flash\
**Created:** [December 30, 2008, 6:02am UTC](https://forum.kirupa.com/t/extending-movieclip-class-and-assigning-dynamically-to-a-class/278445 "2008-12-30T06:02:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![senthilmani](https://avatars.discourse-cdn.com/v4/letter/s/53a042/32.png) [@senthilmani](https://forum.kirupa.com/u/senthilmani)\
**Post date:** [December 30, 2008, 6:02am UTC](https://forum.kirupa.com/t/extending-movieclip-class-and-assigning-dynamically-to-a-class/278445/1 "2008-12-30T06:02:05Z")

</div>

i am trying to extend a moviclip in action script 2 but i am not able to assign to a movieclip dynamically… how do i do it?

here is the code i have written… it doesnt seem to work… somebody help me please

class game.handler extends MovieClip  
{

```
public function onLoad()
{
    trace(this);
    trace("loaded");
}

public function onEnterFrame()
{
    trace("hai");
}

```

}  
import game.handler;  
var box:handler=new handler(this.attachMovie(“handler”,“handler”,this.getNextHighestDepth()));
