# AS3 levels. Not work when associated with class

**URL:** <https://forum.kirupa.com/t/as3-levels-not-work-when-associated-with-class/285301>\
**Category:** flash\
**Created:** [March 30, 2009, 9:56am UTC](https://forum.kirupa.com/t/as3-levels-not-work-when-associated-with-class/285301 "2009-03-30T09:56:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shaedo](https://avatars.discourse-cdn.com/v4/letter/s/e19b73/32.png) [@Shaedo](https://forum.kirupa.com/u/Shaedo)\
**Post date:** [March 30, 2009, 9:56am UTC](https://forum.kirupa.com/t/as3-levels-not-work-when-associated-with-class/285301/1 "2009-03-30T09:56:30Z")

</div>

Hi, Thanks for taking the time to look at my problem.

My question is could someone please explain what I need to do in order to be able to **assign levels to objects that use a custom class**?

I am hoping someone can explain this to me: (please excuse me if I use the wrong syntax)

I have two Movie Clips Red and Blue.  
Both in my library.  
Red has a class file (Red.as), blue uses the default (flash.display.MovieClip) for its base class.

The code I use to initiate them is:

```auto
 
var _red:Red = new Red;
var _blue:Blue = new Blue;
this.addChild(_blue);
this.addChild(_red);

```

Which ever is added 2nd is on top.  
I can then happily assign and trace a level to \_blue eg:

```auto
 
_blue.level = 1;
trace(_blue.level);

```

but If I try that with \_red I get the following error:

> 

1119: Access of possibly undefined property level through a reference with static type Red.

source \_red.level = 1

The code in my Red class simply extend movieclip

```auto
package
{
 import flash.display.MovieClip;
 public class Red extends MovieClip
{
 function Red(){}
}
}

```

can someone explain what I need to do to be able to be able to assign levels to objects that use a custom class?
