# setTextFormat Problem

**URL:** <https://forum.kirupa.com/t/settextformat-problem/252788>\
**Category:** flash\
**Created:** [February 23, 2008, 3:07pm UTC](https://forum.kirupa.com/t/settextformat-problem/252788 "2008-02-23T15:07:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![blue\_chi](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/blue_chi/32/62_2.png) [@blue\_chi](https://forum.kirupa.com/u/blue_chi)\
**Post date:** [February 23, 2008, 3:07pm UTC](https://forum.kirupa.com/t/settextformat-problem/252788/1 "2008-02-23T15:07:08Z")

</div>

I am having a weird problem with setTextFormat, hope somebody could help, I am using the same code in two different places in my project, it works fine in one place and does not work fine in the other. Not sure if this is a scope problem.

This section works fine, it is placed right onto the main timetimline, not called from within any object or anything:

```php
_root.my_fmt = new TextFormat();
_root.my_fmt.font = "my font";

this.createTextField("my2_txt",this.getNextHighestDepth(),10,10,160,120);

this.my2_txt.text = "Hello world";
this.my2_txt.embedFonts = true;
this.my2_txt.selectable = false;
this.my2_txt.setTextFormat(_root.my_fmt);
new Tween(this.my2_txt, "_x", Strong.easeOut, 0, 100, 2, true);

```

This other code is something that I’m calling from within a event listener of a MovieClipLoader and it just does not work.

```php

		
				_root.my_fmt = new TextFormat();
		_root.my_fmt.font = "my font";
		target.createTextField("my_txt",target.getNextHighestDepth,0,0,200,20);
		target.my_txt.text = "myTitle";
		target.my_txt.embedFonts = true;
		target.my_txt.setTextFormat(_root.my_fmt);

```

I can see my text fine if I do not embed the fonts. Can’t really get what the problem is.
