dcsimg
A Flash Developer Resource Site

Results 1 to 10 of 10

Thread: Bolding text in dynamic text box

  1. #1
    Member
    Join Date
    Jan 2001
    Posts
    54
    I am trying to bold a piece of text within a dynamic text box, but the bold is not working. Here is my code:

    <P ALIGN=\"LEFT\"><FONT FACE=\"verdana\" SIZE=\"14\" COLOR=\"#FF9900\"><\"B\">START YOUR TRAINING<\"/B\"></FONT></P><P ALIGN=\"LEFT\"><FONT FACE=\"verdana\" SIZE=\"12\" COLOR=\"#FFFFFF\">Training is simple, just hit the Study button above to begin.</FONT></P>

    The words "START YOUR TRAINING" appear on the stage with the correct font, size, and color, but they are not bolded.

    In my Text Options box I've selected Dynamic Text, Multiline, Embed Fonts, and the HTML box is checked.

    Anybody know what I've done wrong?

  2. #2
    Senior Member
    Join Date
    Aug 2000
    Posts
    264
    You don't need the back slashes around <B> tages, all they do is include the quotations in the string. Try:


    <P ALIGN=\"LEFT\"><FONT FACE=\"Verdana\" SIZE=\"14\" COLOR=\"#FF9900\"><B>START YOUR TRAINING</B></FONT></P><P ALIGN=\"LEFT\"><FONT FACE=\"Verdana\" SIZE=\"12\" COLOR=\"#FFFFFF\">Training is simple, just hit the Study button above to begin.</FONT></P>

    sam

  3. #3
    Member
    Join Date
    Jan 2001
    Posts
    54
    I changed the code to read <B>START YOUR TRAINING</B>, but then the words "START YOUR TRAINING" did not appear on the stage at all. When I removed the <B> and </B> tags altogether, the words appeared again which is good, but I need them bold.

    Any idea what's going on here?

  4. #4
    Senior Member
    Join Date
    May 2001
    Posts
    180
    Yup you need to encode the bold version of the font into the SWF as well. (As its a different font not the normal font just made bolder). Same will go for Italic and Bold Italic if you are using them too.

  5. #5
    Member
    Join Date
    Jan 2001
    Posts
    54
    How do I embed two different fonts in one text box?

  6. #6
    Senior Member
    Join Date
    May 2001
    Posts
    180
    you can't .... you'll have to create an invisble box (either in a non visited previous frame, or off the stage)with each version of the font embedded, which will in turn embed the font into the SWF

  7. #7
    Member
    Join Date
    Jan 2001
    Posts
    54
    That worked! I've been beating my head against a wall for over a week on this problem.

    Thank you!

  8. #8
    Senior Member
    Join Date
    Aug 2000
    Posts
    264
    If you don't mind having aliased fonts, don't embed at all and it will work fine! Verdana is a standard Windows font, so most will have it. Others will just get a similar looking sans font i think!

    Sam

  9. #9
    Junior Member
    Join Date
    Jul 2005
    Posts
    9
    I have a very similar problem, but the text i need to make bold comes from an XML file, so i can't use quote marks. But unless i put the <b> and <\b> in quote marks it says I can't use them. Any ideas how i get round this?

    the code for text i need to make bold is here:
    _root.text1.startimetext1 = this.firstChild.childNodes[3].childNodes[3].firstChild + " \n" + this.firstChild.childNodes[0].childNodes[4].firstChild;

  10. #10
    Junior Member
    Join Date
    Jul 2005
    Posts
    9
    I've found the answer if anyone's interested. you don't use <b> & </b>.
    You create a style sheet after

    _root.text1.startimetext1 = this.firstChild.childNodes[3].childNodes[3].firstChild + " \n" + this.firstChild.childNodes[0].childNodes[4].firstChild;

    that goes like this:

    var boldText:TextFormat = new TextFormat();
    with (boldText) {
    font = "Verdana";
    size = 9.8;
    color = 0x000000;
    bold = true;
    }
    _root.text1.textBoxName.setTextFormat(boldText);

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center