# textFormat stops working on set text in costom text class

**URL:** <https://forum.kirupa.com/t/textformat-stops-working-on-set-text-in-costom-text-class/326081>\
**Category:** flash\
**Created:** [November 21, 2011, 11:01pm UTC](https://forum.kirupa.com/t/textformat-stops-working-on-set-text-in-costom-text-class/326081 "2011-11-21T23:01:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bonassus](https://avatars.discourse-cdn.com/v4/letter/b/ea5d25/32.png) [@bonassus](https://forum.kirupa.com/u/bonassus)\
**Post date:** [November 21, 2011, 11:01pm UTC](https://forum.kirupa.com/t/textformat-stops-working-on-set-text-in-costom-text-class/326081/1 "2011-11-21T23:01:43Z")

</div>

I have a textDisplay class that i want to instantiate in another class and set the text property with the function setText. It works but the problem is that the textformat stops working when I call setText(\_theText); if i comment this out the textformat works. how can i make the textformat update with \_theText.

```auto

package view
{
    import flash.display.MovieClip;
    import flash.text.TextField;
    import flash.text.TextFormat;

    public class TextDisplay extends MovieClip{

    private var textFormat:TextFormat = new TextFormat();
    private var _OxLabel:TextField = new TextField();
    private var _theText:String = "100";

        public function TextDisplay(){

            textFormat.font = "Arial";
            textFormat.size = 21;
            textFormat.bold = true;
            textFormat.color = 0xffffff;

            _OxLabel.text = _theText;
            _OxLabel.setTextFormat(textFormat);
            _OxLabel.selectable = false;
            _OxLabel.mouseEnabled = false;
            addChild(_OxLabel);
        }

         private function setText(_theText){
        _OxLabel.text = _theText;
    }

        public function set theText(value:String):void {
            _theText = value;
            setText(_theText);
        }
    }
}

```

Thanks!
