A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Boldening dynamically filled text box.

  1. #1
    Join Date
    Jul 2008

    Boldening dynamically filled text box.

    Hi, I have a dynamic textfield "chap1text" inside "chap1textbox", and it is gradually filled one character at a time using a script.

    no matter what I do, it isn't going bold!!! Have tried a few things, what's the best way to make dynamic text bold?!

    If I write the text in the textbox it works fine, but if I try and fill it with the below script it goes completely WHACK!

    Thanks, Dave

    Actionscript Code:

    var firstName = "dug";
    var companyName = "flappyjacks";
    var chap1content = "blah blah blah" + firstName + "blah blah blah";

    bodyTextFormat.bold = true;

    var textLength = chap1content.length;
    var num;

    num = 0;

    var scorevar = _root.score;

    externalvar.text = scorevar;

    chap1textbox.onEnterFrame = function()
        if(num >= textLength)
            chap1textbox.chap1text.text = chap1content;
        else if(num < textLength)
            chap1textbox.chap1text.text = substring(chap1content, 1, num);
            num ++;
            //trace("Num = " + num + "\ntextlength = " + textLength);
            //trace(specify number)

  2. #2
    Moderator whispers's Avatar
    Join Date
    Mar 2001
    CFA2h (respect the HEX)
    what do you mean? gradually filled in? like using a mask? (which I dont see in you code anywhere?)

    or do you just mean 1 character appears/is displayed in the field 1 at a time..building a word/sentence?

    cant you just BOLD the text field you are using?
    or use a textFormat to apply to the text field after each character is added?

    I dont see either/any of that going on or even attempted?

  3. #3
    Join Date
    Jul 2008
    This script made the text came in letter by letter, at the time of writing I'd tried assigning that text format to the textbox, with no joy - same with changing the text box to bold.

    After a while, I managed it with HTML text, I think it went something like this:
    Actionscript Code:
    chap1textbox.chap1text.html = true
    chap1textbox.chap1text.htmlText = "<b>" + substring(chap1content, 1, num) + "</b>";

    The text then came in letter by letter, bold. Thanks for the reply!


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