我试图嵌入我的自定义字体在Flash应用程序,但我得到的编译过程中出现以下错误:不能在AS3中嵌入字体时,Flash
C:\Users\trap\Downloads\flex_sdk_4.6\bin>mxmlc test.as
C:\Users\trap\Downloads\flex_sdk_4.6\bin\test.as: Error: A file found in a source-path 'test' must have the same name as the class definition inside the file 'EmbededFonts'.
这里是我的代码:
package {
import flash.display.Sprite;
import flash.text.TextField;
import flash.text.TextFormat;
public class EmbededFonts extends Sprite {
[Embed(source = "dexter.ttf",
fontName = "myFont",
mimeType = "application/x-font",
fontWeight = "normal",
fontStyle = "normal",
advancedAntiAliasing = "true",
embedAsCFF = "false")]
private var fontFontSample: Class;
public function EmbededFonts() {
super();
var textFormat: TextFormat = new TextFormat();
textFormat.font = "myFont";
textFormat.bold = true;
textFormat.letterSpacing = 10;
var textField: TextField = new TextField();
textField.width = 300;
textField.embedFonts = true
textField.text = "Use embeded font";
textField.textColor = 0x0000ff;
textField.setTextFormat(textFormat);
this.addChild(textField);
}
}
}