我正嘗試在flex4.11 sdk中使用@ font-face在外部css文件中嵌入字體。該代碼段是這樣的,在flex4.11中跨域使用@ font-face嵌入字體
MyOwnFontStyle.css:
@namespace s "library://ns.adobe.com/flex/spark";
@namespace mx "library://ns.adobe.com/flex/mx";
@font-face {
src:url("font/GOTHICB.ttf");
fontFamily: myFontFamily;
embedAsCFF: true;
fontWeight: bold;
}
s|VGroup {
fontFamily: myFontFamily;
fontSize: 15;
}
它成功地建立沒有任何錯誤。但是當啓動應用程序時,它會像下面那樣拋出運行時錯誤,
ArgumentError:錯誤#1508:爲參數字體指定的值無效。 在的flash.text ::字體$/registerFont() 在MyOwnFontStyle/setStyleDeclarations() 在MethodInfo的-19757() 在flash.events::EventDispatcher/dispatchEventFunction() 在flash.events::EventDispatcher/dispatchEvent( ) 在ModuleInfoProxy/moduleEventHandler() 在flash.events::EventDispatcher/dispatchEventFunction() 在flash.events::EventDispatcher/dispatchEvent() 在ModuleInfo /爲readyHandler() 在flash.events::EventDispatcher/dispatchEventFunction( ) at flash.events::EventDispatcher/dispatchEvent() at mx.core :: FlexModuleFactory/update() at mx.core :: FlexModuleFactory/docFrameHandler() ) at mx.core :: FlexModuleFactory/docFrameListener()
如果有人遇到這種事情,請分享您的想法來解決此問題。提前致謝。
感謝您的回覆。現在它對我來說工作得很好。如果有人遇到同樣的問題,請強制包含「import mx.core.EmbeddedFontRegistry; private var embeddedFontRegistry:EmbeddedFontRegistry;」在你的主應用程序中。 – raj
如果這個答案對你有幫助,那麼你可以批准它嗎? – Anton