0

I recently upgraded to Adobe CC from Adobe CS6, and none of my text is showing in my Flash Professional project anymore. It contains a lot of dynamic text and htmlText. I'm not quite sure if I was doing it properly before, as I read several guides that explained different methods, but at least it was working.

I've had some success in trying to fix everything, but I would appreciate it if anyone could tell me the proper way to do it with Adobe CC. Here's how I'm trying to do it now.

  1. Add the font to the library, check the "Export for Actionscript" box, and assign a class name.
  2. Create an instance of the font and the bold and italic versions:

    var myFont:Font = new MyFont();
    var myFontBold:Font = new MyFontBold();
    var myFontItalic:Font = new MyFontItalic();
    
  3. Set up the textFormat:

    var myTextFormat:TextFormat = new TextFormat();
    myTextFormat.font = myFont.fontName;
    
  4. Set up the textField and apply the textFormat:

    var myTextField:TextField = new TextField();
    myTextField.defaultTextFormat = myTextFormat;
    

This will get the text to display, but if I try putting bold or italic tags in my htmlText, neither of them work.

myTextField.htmlText = "This is <b>bold</b>. This is <i>italic</i>.";

Also, do I need to do Font.registerFont anymore? I had that in my previous code, but I was never sure why I needed it.

BadFeelingAboutThis
  • 14,445
  • 2
  • 33
  • 40
BladePoint
  • 632
  • 5
  • 16
  • I forgot to say that I did do the same thing for both the bold and italic versions of the font. – BladePoint Oct 20 '14 at 16:23
  • for html text, I think you need to create a style sheet and assign your italic and bold version of the fonts to the `b` and `i` tags (or strong and em if you want to be more up to date with web standards) – BadFeelingAboutThis Oct 20 '14 at 16:24

1 Answers1

1

Try creating and setting a style sheet that assigns the bold and italic versions of the font to the appropriate tags:

var style:StyleSheet = new StyleSheet();
style.setStyle("i", {fontFamily: myFontItalic.fontName});
style.setStyle("b", {fontFamily: myFontBold.fontName});

myTextField.styleSheet = style;

myTextField.htmlText = "This is <b>bold</b>. This is <i>italic</i>.";
BadFeelingAboutThis
  • 14,445
  • 2
  • 33
  • 40
  • I tired it in cc (2014) and it worked. Can you share your .fla? – BadFeelingAboutThis Oct 21 '14 at 22:26
  • I got it to work, but I also discovered something bizarre. When I used setStyle to create an tag for bold italic, I got it to work for the first time! Then when I used instead of and instead of , those things worked also. The only problem is that these custom tags all create a new line at the end of them for some reason. :/ Any more insight would be appreciated. Here's my .fla https://www.mediafire.com/?0t3mbm6vu81e7eo – BladePoint Oct 22 '14 at 14:43
  • Okay, adding display:"inline" fixes the new line problem, so everything is pretty much working. It would just be nice if I could use the and tags instead of creating my own tag names. I thought it was supposed to overwrite the defaults when I setStyle and ? – BladePoint Oct 22 '14 at 14:59
  • It should. When I tried the code in my answer it worked fine for me. Without seeing your .fla it's hard to tell what could be the problem - glad you got it working at least somewhat though! – BadFeelingAboutThis Oct 22 '14 at 17:07