# Custom Class

**URL:** <https://forum.kirupa.com/t/custom-class/241636>\
**Category:** Uncategorized\
**Created:** [October 16, 2007, 12:55pm UTC](https://forum.kirupa.com/t/custom-class/241636 "2007-10-16T12:55:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bardic](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/bardic/32/3708_2.png) [@bardic](https://forum.kirupa.com/u/bardic)\
**Post date:** [October 16, 2007, 12:55pm UTC](https://forum.kirupa.com/t/custom-class/241636/1 "2007-10-16T12:55:29Z")

</div>

I’m trying to write my first custom class and I am having a few problems with it. If anyone could point out where my problems are or give a link to a good resource on learning more about custom classes that would be wonderful.

```auto

class spawnTextFields {
         public function spawnTextFields(target:String,txtName:String,depth,xLoc,yLoc,setStr:String){
        if(depth == null){
            depth = this.getNextHighestDepth();
        }
        
        target.createTextField([txtName],[depth],0,0,0,0);
        target.txtName.text = [setStr];
        target.txtName.autoSize=true;
    }
}

```

When I run that I get the following errors:

There is no method with the name ‘getNextHighestDepth’.
