I build interface where user select font form list, font is loaded and 
applied to text in textarea. I found that my method works only once on, 
subsequent loading not embed new font. What can i fix?
1. template class for compiling with embedded font
package
{
    import flash.display.Sprite;
   
    public class FontTemplate extends Sprite
    {
        [Embed(source='../../@FONT_FILE@', fontName='@FONT_NAME@', 
mimeType='application/x-font')]
        public var myFont:Class;
    }
}
2.class fragment about loading
private function loadFont():void{
                    var context:LoaderContext=new LoaderContext()
                    
context.applicationDomain=ApplicationDomain.currentDomain
                    var req:URLRequest=new 
URLRequest(designElement.designElementVO.font.swf_glyphs_url)
                    ld=new Loader()
                    
ld.contentLoaderInfo.addEventListener(Event.COMPLETE,evFontLoaded)
                    ld.load(req,context)
                }
                private function evFontLoaded(e:Event):void{
                    var content:DisplayObject=ld.content
                    var cl:Class=content["myFont"];
                    Font.registerFont(cl)
                    var fonts:Array=Font.enumerateFonts()
                    var str:String="Embeded fonts:\n"
                    for(var i:uint=0;i<fonts.length;i++){
                        str+=Font( fonts[i] ).fontName+"\n"
                    }
                    trace(str)
                    tf.setStyle("fontFamily",
...

-- 
Robert Was





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/flexcoders/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to