2 problems: 1. embedFonts makes text disappear, 2. dynamic text vertical position

I have the following code:


this.createTextField ("imageText",2,95,0,390,96);

imageText.multiline = true;
imageText.wordWrap = true;
imageText.autoSize = true;
//imageText.embedFonts = true;
imageText.html = true;
imageText.htmlText = text; // variable loaded earlier in script....
imageText.selectable = true;

imageTextFormat = new TextFormat();
imageTextFormat.color = 0xCA9E1D;
imageTextFormat.size = 16;
imageTextFormat.font = "Sabon RomanSC";
imageText.setTextFormat(imageTextFormat);
//imageText.embedFonts = true;
trace(imageText.text);

The problem:
If I uncomment either of the imageText.embedFonts lines, my text will disappear… but the trace(imageText.text); will still return the correct contents. It’s as though embedFonts causes the textField to disappear.

Possibly related, (but maybe not), is the fact that the vertical positioning of the font is off. Even though I create the textField at Y = 0, the text writes somewhere around Y = 10. I suspect this is something else, but I thought I’d add it just in case.

Any help with either (or both) problems would be fabulous. Thanks,
Drew

EmbedFonts issue: Did you remember to import the font directly into the library then set it’s linkage setting to export for actionscript so it can be used by the movie/script?

Offset Issue: Sounds like an issue with your .txt file. Flash automatically converts line returns in your .txt file, so if you hit the enter button to get to a next line, Flash automatically makes that a new paragraph.

You can however avoid this using textFieldInstanceName.condenseWhite = true so that it will remove all the whitespace (will reduce it to 1 single space [like the spacebar]) and you will only be able to do line returns using the <BR> HTML tag

Thanks! I hadn’t pulled the font into the Library. Problem 1 resoloved - works like a charm now.
I looked all over but I didn’t find that documented anywhere. Did I overlook some obvious documentation? If not, where would you suggest I look for this type of info (aside from posting here)?

On problem 2, oddly enough, the text is still offset. For development simplicity I’m just declaring a dummy value for now:


{SNIP}
var text = "The quick brown fox was jumping and something else happened, too."
{/SNIP}
....
this.createTextField ("imageText",2,95,0,390,96);
with (imageText) {
	multiline = true;
	wordWrap = true;
	condenseWhite = true;
	embedFonts = true;
	autoSize = true;
	html = true;
}
imageText.htmlText = text;

imageTextFormat = new TextFormat();
with (imageTextFormat) {
	color = 0xCA9E1D;
	size = 16;
	font = "Sabon RomanSC";
}

imageText.setTextFormat(imageTextFormat);

That still ends up placing the text about 5 pixels down. I’ve tried changing fonts, adding / removing borders and a few other things. I’ve ‘fixed’ it for now by setting the y to -5, but I’d be happy for any insight into why this might be.
Thanks again,
Drew

Glad you fixed problem 1 =) As for overlooking obvious documentation, no… i don’t think so, I don’t remember where I learned to import the font into the library, probably from this forum though. I know I knew it before, but I also read it here if that helps you out…

http://actionscript-toolbox.com/flashmx_createtext.php

Now onto the spacing problem. Perhaps it is the font you are using? I tried this code…

[AS]var text = “The quick brown fox was jumping and something else happened, too.”;
this.createTextField(“imageText”, 2, 95, 0, 390, 96);
with (imageText) {
multiline = true;
wordWrap = true;
condenseWhite = true;
//embedFonts = true;
autoSize = true;
html = true;
border = true;
}
imageText.htmlText = text;
imageTextFormat = new TextFormat();
with (imageTextFormat) {
color = 0xCA9E1D;
size = 16;
font = “Arial”;
}
imageText.setTextFormat(imageTextFormat);[/AS]

And saw no weird spacing issues. I changed the font to Arial and stopped embedding it because I don’t have your font on my machine, then I turned on the border for the textbox so I can see the spacing, and everything looked fine to me.