开发者

Getting bulleted, bold, embedded text to display in Flash CS5

I am dubious that anyone will be able to help, but thought I'd post just in case...

I'm trying to get Flash to display a bulleted list using bold embedd开发者_StackOverflowed fonts.

What I'm finding is that I can get bold fonts with bullets, but not embedded. Or embedded fonts with bullets that aren't bold, or bold embedded fonts without bullets.

This is incredibly frustrating (as well as annoying).

I'm embedding the fonts in the library and exporting them via actionscript. Here's my code...

var tf:TextField = new TextField();
        tf.multiline = true;            
        tf.width = 100;         
        tf.x = 200;
        tf.y = 100;
        tf.antiAliasType = AntiAliasType.ADVANCED;
        tf.wordWrap = true;
        tf.autoSize = TextFieldAutoSize.LEFT;
        tf.embedFonts = true;


        var bulletTF:TextFormat = new TextFormat();   


        var myFontBold:VerdBold = new  VerdBold();
        var myFont:Verd = new  Verd();

        bulletTF.font = myFont.fontName;                        

        bulletTF.size = 12;
        bulletTF.bullet = true;
        tf.htmlText ="This is the first bullet, but this text should wrap correctly.<br>and another<br>And another still" ;
        tf.setTextFormat(bulletTF);         

        addChild(tf);

The above code produces the regular font embedded bulleted list.

If I change the bulletTF.font line to bulletTF.font = myFontBold.fontName The font goes bold and the bullets go away.

Has anyone dealt with this? And if so... what was your solution (or workaround).

Much obliged in advance.


You need to embed both the bold font and the normal font. Also rather than using TextFormat to set the format, you might get more predictable results by setting HTML tags directly:

var myFontBold:VerdBold = new  VerdBold();
var myFont:Verd = new  Verd();

tf.htmlText = '<p><font face="' + myFont.fontName + '">Some regular text</font></p><ul><li><font face="' + myFontBold.fontName + '">Some bold text</font></li></ul>';

It's ugly but normally it should work. Using <b> might also work, but I think it's more reliable to explicitly set the font names.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜