CreateTextField, Embed Font

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]

Is your font included in the library?

Yeah

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]

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]

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?

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.

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";

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

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

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.