# Problem With Changing Properties of Custom TextField Class

**URL:** <https://forum.kirupa.com/t/problem-with-changing-properties-of-custom-textfield-class/318347>\
**Category:** flash\
**Created:** [January 17, 2011, 9:52pm UTC](https://forum.kirupa.com/t/problem-with-changing-properties-of-custom-textfield-class/318347 "2011-01-17T21:52:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![marlonpando](https://avatars.discourse-cdn.com/v4/letter/m/ea5d25/32.png) [@marlonpando](https://forum.kirupa.com/u/marlonpando)\
**Post date:** [January 17, 2011, 9:52pm UTC](https://forum.kirupa.com/t/problem-with-changing-properties-of-custom-textfield-class/318347/1 "2011-01-17T21:52:23Z")

</div>

I wrote a simple class called CustomTextField.as as follows:

package{

```
import flash.text.TextField;

public class CustomTextField extends TextField{

    private var custom_TextField:TextField=new TextField();

    public function CustomTextField(){
        initCustomTextField();
    }

    private function initCustomTextField():TextField{
        custom_TextField.background=true;
        custom_TextField.backgroundColor=0x333333;
        return custom_TextField;
    }

}

```

}

…and I am initiating it inside a document class as follows:

private var myTextField:CustomTextField = new CustomTextField();  
myTextField.text=“Hello World!”  
stage.addChild(myTextField);

It is not throwing an error but the background color is unchanged.

Can anyone answer this or help point me in the right direction?

Thanks in advance.
