# TextFormat weirdness

**URL:** <https://forum.kirupa.com/t/textformat-weirdness/243851>\
**Category:** flash\
**Created:** [November 11, 2007, 9:11pm UTC](https://forum.kirupa.com/t/textformat-weirdness/243851 "2007-11-11T21:11:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ethernal](https://avatars.discourse-cdn.com/v4/letter/e/e47c2d/32.png) [@ethernal](https://forum.kirupa.com/u/ethernal)\
**Post date:** [November 11, 2007, 9:11pm UTC](https://forum.kirupa.com/t/textformat-weirdness/243851/1 "2007-11-11T21:11:45Z")

</div>

I have the following code:

```php
package {

    import flash.display.Sprite;
    import flash.events.TimerEvent;
    import flash.text.TextField;
    import flash.text.TextFieldAutoSize;
    import flash.text.TextFormat;
    import flash.utils.Timer;
    
    public class AnimateText {
        
        private var _text:String;
        private var _holder:Sprite;
        private var _textfield:TextField;
        private var _fmt:TextFormat;
        private var _timer:Timer;
        private var _cont:uint = 1;
        
        public function AnimateText() {
            _text = "Hello world";
            
            _holder = new Sprite();
            TopLevel.stage.addChild(_holder);
            
            _fmt = new TextFormat();
            _fmt.font = "Arial";
            _fmt.size = 18;
            
            _textfield = new TextField();
            _textfield.autoSize = TextFieldAutoSize.LEFT;
            _textfield.setTextFormat(_fmt);
            _holder.addChild(_textfield);
            
            
            
            _timer = new Timer(100, _text.length);
            _timer.addEventListener(TimerEvent.TIMER, onTimerTick);
            _timer.start();
        }
        
        private function onTimerTick(evt:TimerEvent):void {
            _textfield.text = _text.substr(0, _cont++);
        }
        
    }
    
}

```

When publishing, the textfield does not have any textformat. However, if I change the following:

```php
private function onTimerTick(evt:TimerEvent):void {
            _textfield.text = _text.substr(0, _cont++);
            _textfield.setTextFormat(_fmt);
 }

```

It works fine. Why do I have to apply the TextFormat in every tick of the Timer? It does the same with an ENTER\_FRAME event, and I don’t understand it.
