Hi,
I’m having a problem with embedding of fonts. Tried several ways to do this; with the library, and with the [embed]-code.
This is my actionscript now:
//rssReader.as
package classes.RSS {
import flash.display.*;
import flash.events.*;
import flash.net.*;
import flash.utils.*;
import flash.text.*;
import Main;
public class rssReader extends Sprite {
[Embed(source='/classes/fonts/Chalkboard.ttf', fontName="Chalkboard", mimeType="application/x-font-truetype")]
public function rssReader(_xmlURL) {
var xmlLoader:URLLoader = new URLLoader();
var xmlData:XML = new XML();
xmlLoader.addEventListener(Event.COMPLETE, LoadXML);
xmlLoader.load(new URLRequest(_xmlURL));
function LoadXML(e:Event):void {
xmlData = new XML(e.target.data);
textBox(xmlData);
}
function textBox(rssInput:XML) {
var formatTittel:TextFormat = new TextFormat();
formatTittel.font = "Chalkboard";
formatTittel.color = 0xFF0000;
formatTittel.size = 13;
var Tittel:TextField = new TextField();
Tittel.embedFonts = true;
Tittel.text = "Test Arial";
Tittel.defaultTextFormat = formatTittel;
Tittel.width = 130;
Tittel.height = 205;
Tittel.x = 10;
Tittel.y = 85;
addChild(Tittel);
With this code, the text isn’t shown.
If I remove the “Tittel.embedFonts = true;” statement the text is shown, but in the wrong font.
The file chalboard.ttf is placed in one of the subfolders (the root folder is where Main.as and the .fla-file is).
Does anyone know why it wont work?