-
Font embed
Hi I am using CS4 and AS2. I have created a font library item and would like to apply it to several dynamic fields. The dynamic fields load HTML formatted text files. I don't know how to make the text appear in my font. Does anyone have any ideas? Thanks in advance...
-
Define a TextFormat and apply that format to the TextField.
-
Hi there. That's the problem, I don't know how to do that bit and can't find a simple explanation or sample actionscript. I created a library item called it 'ComingUp', but don't know what to do after that, even if it needs things setting in the linkage, etc.
Thanks
-
Ok...
In the Library, right-click on the Font and select Properties. Make sure you have the characters selected you want to embed. Then go to Actionscript, and then Linkage and select "Export for Actionscript" and "Export in frame 1". Give it an identifier of ComingUp.
Let's say you have a textfield on the stage with an instance name of myText. You'd add this ActionScript:
Code:
myFormat=new TextFormat();
myFormat.font="ComingUp";
myText.text="blah blah blah";
myText.embedFonts=true;
myText.setTextFormat(myFormat);
-
Thanks very much. Where you've put 'blah blah...' can I specify an external txt file? Much appreciated
-
Thanks for your help so far, but I am still really stuck. The font embed works well, but I need to apply it to some text that is loaded dynamically and it won't work. Please could somebody have a look at the code:
myLoadVars = new LoadVars();
myLoadVars.onLoad = function() {
// the data is loaded in the myLoadVars object as a property of the object
myText.htmlText = myLoadVars.topHTMLdata;
}
myLoadVars.load("text1.txt");
{
}
myFormat=new TextFormat();
myFormat.font="ComingUp";
myText.text="";
myText.embedFonts=true;
myText.setTextFormat(myFormat);
Thanks again.
-
This line:
is erasing any text in the field. Remove that line.
-
1 Attachment(s)
Thanks, but it's doesn't display. I have tried another method, but it won't allow the HTML to display, please take a look at the attached if you have a spare minute.