A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: making text bold in textfield

  1. #1
    Senior Member gordonart's Avatar
    Join Date
    Jun 2003
    Location
    Sweden
    Posts
    267

    making text bold in textfield

    I want to make an imported text from a textfile be bold.
    How do I do it?

    This is what it looks like now:

    this.createTextField("my_txt", 10, 10, 10, 80, 100);
    my_txt.setNewTextFormat(new TextFormat("Arial",12,0xCC6600));
    boldFormat = new TextFormat();
    boldFormat.bold = true;
    my_text.setTextFormat(0,99,boldFormat);
    my_txt.autoSize = "left";
    my_txt.border = false;
    my_txt.multiline = true;
    my_txt.wordWrap = true;
    my_txt._height = 100;

    var lorem_lv:LoadVars = new LoadVars();
    lorem_lv.onData = function (src:String):Void {
    if (src != undefined) {
    my_txt.text = src;
    } else {
    my_txt.text = "Unable to load external file.";
    }
    }
    lorem_lv.load("upload/flash/start_files/skylt1.txt");
    Mattias Gordon
    illustrator/ animator

  2. #2
    Senior Member
    Join Date
    Oct 2004
    Location
    London
    Posts
    186
    I think you have to use the setTextFormat command after the text has been loaded, but I'm not 100% sure.

    Maybe try it like this:

    Code:
    if (src != undefined) {
    my_txt.text = src;
    my_txt.setTextFormat(boldFormat);
    } else {
    my_txt.text = "Unable to load external file.";
    my_txt.setTextFormat(boldFormat);
    }

  3. #3
    Senior Member gordonart's Avatar
    Join Date
    Jun 2003
    Location
    Sweden
    Posts
    267
    I could not make it work. I put it after and the way you did above put it did not work.
    Mattias Gordon
    illustrator/ animator

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