# CreateTextField, Embed Font

**URL:** <https://forum.kirupa.com/t/createtextfield-embed-font/21570>\
**Category:** flash\
**Created:** [May 23, 2003, 4:30am UTC](https://forum.kirupa.com/t/createtextfield-embed-font/21570 "2003-05-23T04:30:32Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![wyclef](https://avatars.discourse-cdn.com/v4/letter/w/65b543/32.png) [@wyclef](https://forum.kirupa.com/u/wyclef)\
**Post date:** [May 23, 2003, 4:30am UTC](https://forum.kirupa.com/t/createtextfield-embed-font/21570/1 "2003-05-23T04:30:32Z")

</div>

What’s wrong with this?

[AS]  
loadStatus\_mc.progressBar\_mc.\_xscale = 1;  
setProperty (“loadStatus\_mc”, \_x, 210);  
setProperty (“loadStatus\_mc”, \_y, 200);  
this.createEmptyMovieClip (“preloader”, 1);  
this.createTextField (“loadStatus\_txt”, 2, 210, 220, 0, 0);  
this.loadStatus\_txt.background = true;  
this.loadStatus\_txt.selectable = false;  
this.loadStatus\_txt.border = false;  
this.loadStatus\_txt.text = “Loading Application”;  
this.loadStatus\_txt.myTextField.setTextFormat(myTextFormat);  
this.myTextFormat = new TextFormat();  
this.myTextFormat.font = “MiniHaHa”;  
this.myTextFormat.size = 10;  
this.myTextFormat.color = 0xFFFFFF;  
this.myTextFormat.embedFonts = true;  
this.preloader.onEnterFrame = function () {  
this.percentDone = math.floor ((this.\_parent.getBytesLoaded () / this.\_parent.getBytesTotal ()) \* 100);  
loadStatus\_txt.text = this.percentDone + “% Complete”;  
loadStatus\_mc.progressBar\_mc.\_xscale = this.percentDone;  
this.loaded = this.\_parent.\_framesloaded;  
if (this.\_parent.getBytesLoaded () == this.\_parent.getBytesTotal ()) {  
trace (“Done”);  
removeMovieClip (“preloader”);  
gotoAndStop (“init”);  
}  
};  
[/AS]

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 23, 2003, 4:31am UTC](https://forum.kirupa.com/t/createtextfield-embed-font/21570/2 "2003-05-23T04:31:34Z")

</div>

Is your font included in the library?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 23, 2003, 4:39am UTC](https://forum.kirupa.com/t/createtextfield-embed-font/21570/3 "2003-05-23T04:39:48Z")

</div>

Yeah

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 23, 2003, 4:43am UTC](https://forum.kirupa.com/t/createtextfield-embed-font/21570/4 "2003-05-23T04:43:49Z")

</div>

OK hmm,

this.loadStatus\_txt.myTextField.setTextFormat(myTextFormat);

That is defined BEFORE you create the text format, you should call the text format after you create it.

Also… that sets the text format for loadStatus\_txt.myTextField but in your script you use loadStatus\_txt.text , shouldn’t it be loadStatus\_txt.myTextField.text??

[edit]No wait, it should be loadStatus\_txt.setTextFormat(myTextFormat) sorry[/edit]

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 23, 2003, 4:48am UTC](https://forum.kirupa.com/t/createtextfield-embed-font/21570/5 "2003-05-23T04:48:27Z")

</div>

I updated the script…it still doesn’t work…

[AS]  
loadStatus\_mc.progressBar\_mc.\_xscale = 1;  
setProperty (“loadStatus\_mc”, \_x, 210);  
setProperty (“loadStatus\_mc”, \_y, 200);  
this.createEmptyMovieClip (“preloader”, 1);  
this.createTextField (“loadStatus\_txt”, 2, 210, 220, 0, 0);  
this.loadStatus\_txt.background = true;  
this.loadStatus\_txt.selectable = false;  
this.loadStatus\_txt.border = false;  
this.loadStatus\_txt.text = “Loading Application”;  
this.myTextFormat = new TextFormat();  
this.myTextFormat.font = “MiniHaHa”;  
this.myTextFormat.size = 10;  
this.myTextFormat.color = 0xFFFFFF;  
this.myTextFormat.embedFonts = true;  
this.loadStatus\_txt.setTextFormat(myTextFormat);  
this.preloader.onEnterFrame = function () {  
this.percentDone = math.floor ((this.\_parent.getBytesLoaded () / this.\_parent.getBytesTotal ()) \* 100);  
loadStatus\_txt.text = this.percentDone + “% Complete”;  
loadStatus\_mc.progressBar\_mc.\_xscale = this.percentDone;  
this.loaded = this.\_parent.\_framesloaded;  
if (this.\_parent.getBytesLoaded () == this.\_parent.getBytesTotal ()) {  
trace (“Done”);  
removeMovieClip (“preloader”);  
gotoAndStop (“init”);  
}  
};  
[/AS]

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 23, 2003, 4:54am UTC](https://forum.kirupa.com/t/createtextfield-embed-font/21570/6 "2003-05-23T04:54:58Z")

</div>

This is pretty hard to do without seeing your file. I don’t know how you have everything set up and such. Can you post your .fla file?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 23, 2003, 5:01am UTC](https://forum.kirupa.com/t/createtextfield-embed-font/21570/7 "2003-05-23T05:01:08Z")

</div>

Well, it’s really simple, I have an rectangular MC on the \_root level named loadStatus\_mc, and then inside that there is another MC that would fill that rectangle by percentage loaded named progressBar\_mc. let me know if this helps.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 23, 2003, 5:09am UTC](https://forum.kirupa.com/t/createtextfield-embed-font/21570/8 "2003-05-23T05:09:02Z")

</div>

Ok try this…

[AS]loadStatus\_mc.progressBar\_mc.\_xscale = 1;  
setProperty(“loadStatus\_mc”, \_x, 210);  
setProperty(“loadStatus\_mc”, \_y, 200);  
this.createEmptyMovieClip(“preloader”, 1);  
this.createTextField(“loadStatus\_txt”, 2, 210, 220, 0, 0);  
this.loadStatus\_txt.background = true;  
this.loadStatus\_txt.selectable = false;  
this.loadStatus\_txt.border = false;  
this.loadStatus\_txt.text = “Loading Application: “;  
this.myTextFormat = new TextFormat();  
this.myTextFormat.font = “MiniHaHa”;  
this.myTextFormat.size = 10;  
this.myTextFormat.color = 0xFFFFFF;  
this.myTextFormat.embedFonts = true;  
this.preloader.onEnterFrame = function() {  
this.percentDone = math.floor((this.\_parent.getBytesLoaded()/this.\_parent.getBytesTotal())\*100);  
loadStatus\_txt.text += this.percentDone+”% Complete”;  
loadStatus\_txt.setTextFormat(myTextFormat);  
loadStatus\_mc.progressBar\_mc.\_xscale = this.percentDone;  
this.loaded = this.\_parent.\_framesloaded;  
if (this.\_parent.getBytesLoaded() == this.\_parent.getBytesTotal()) {  
trace(“Done”);  
removeMovieClip(“preloader”);  
gotoAndStop(“init”);  
}  
};[/AS]

I moved loadStatus\_txt.setTextFormat(myTextFormat); down below loadStatus\_txt.text = this.percentDone+"% Complete";

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 23, 2003, 1:10pm UTC](https://forum.kirupa.com/t/createtextfield-embed-font/21570/9 "2003-05-23T13:10:32Z")

</div>

It still doesn’t work right. I’ve uploade an example.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 23, 2003, 4:45pm UTC](https://forum.kirupa.com/t/createtextfield-embed-font/21570/10 "2003-05-23T16:45:21Z")

</div>

This is driving me nuts man. I really don’t know whats up.

I finally realized that embedFonts is not a TextFormat property, but a TextField property, so we were declaring that wrong.

And I realized that we don’t need setTextFormat in the onEnterFrame because we can can use setNewTextFormat (this is what is used if you will be updating the text in a textfield).

So I changed these, but the text only shows if I set embedFonts to false. It won’t work if I set it to true.

So I decided to do a little search on what we may be doing wrong and I found this tutorial…

[http://actionscript-toolbox.com/flashmx\_createtext.php](http://actionscript-toolbox.com/flashmx_createtext.php)

They show you how to use embedFonts and I used it exactly as they said and it STILL won’t work. I did use the code from the tutorial and it worked perfectly fine for that. But the thing is with that, if you embed the font outline your font becomes blurry. I tested this in a textbox on the stage as well to make sure positioning was fine, and it still went blurry.

Well blurry or not the font worked using the script in the tutorial, but not using the your script, which wasn’t any different.

I tried, but I can’t seem to figure this thing out, sorry.
