# Extends MovieClip type mismatch?

**URL:** <https://forum.kirupa.com/t/extends-movieclip-type-mismatch/168685>\
**Category:** Uncategorized\
**Created:** [November 9, 2005, 8:26am UTC](https://forum.kirupa.com/t/extends-movieclip-type-mismatch/168685 "2005-11-09T08:26:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tecknoize](https://avatars.discourse-cdn.com/v4/letter/t/a88e57/32.png) [@tecknoize](https://forum.kirupa.com/u/tecknoize)\
**Post date:** [November 9, 2005, 8:26am UTC](https://forum.kirupa.com/t/extends-movieclip-type-mismatch/168685/1 "2005-11-09T08:26:48Z")

</div>

Hi there!

I’m really scratching my head right now…  
Take a look…

This is class A

```auto
 
class A extends MovieClip
{
public function A()
{
}
}

```

And this is the code to create a movieClip (on the \_root) based on class A

```auto
 
var a:A = _root.createEmptyMovieClip("dude",1);

```

This works. But then come class B:

```auto
 
class B extends MovieClip
{
public function B(createdBy:MovieClip)
{
this = createdBy.createEmptyMovieClip("dude",1);
}
}

```

And then the code to create it :

```auto
var b:B = new B(_root);

```

This “B” class send me a nice Type mismatch error because “this” is a B and “createdBy.createEmptyMovieClip(“dude”,1)” is a MovieClip. That’s strange… My class isn’t extending the MovieClip class?

What I’m trying to do is asign a MovieClip to a class. So that class IS actualy that movieClip. Somewhat like a component. In fact, I want to be able to create my movieClip with my class… so after I’ll be able to access it by the name I have given to the class, not the instance name of the movieClip.

So each instance of, let’s say B, will be accessible within the class. I know I could do something like :

```auto
 
class B extends MovieClip
{
public var mc:MovieClip;
public function B(createdBy:MovieClip)
{
mc = createdBy.createEmptyMovieClip("dude",1);
}
}

```

But I don’t know… why extends MovieClip in this case?  
Because what I’m trying to do is a movieClip at the end…

I hope I don’t sound to confusing… :S  
Thank you!
