dcsimg
A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: font color change with code

  1. #1
    Senior Member
    Join Date
    Aug 2000
    Posts
    184

    font color change with code

    is it possible to change the color of a font in a dynamic txt field with code?

    slimpixi

  2. #2
    Developer
    Join Date
    Sep 2001
    Location
    The Bluegrass State Will Flash For Food
    Posts
    3,789
    Code:
    _txt.textColor = 0x000000;

  3. #3
    Senior Member vucjak's Avatar
    Join Date
    Mar 2002
    Location
    BanjaLuka, RS, Bosnia
    Posts
    306
    and how do you assign that to text field?
    to his property?

  4. #4
    Developer
    Join Date
    Sep 2001
    Location
    The Bluegrass State Will Flash For Food
    Posts
    3,789
    _txt is the instance name of the text field 0x000000 represents the rgb values of the color (0xrrggbb);

  5. #5
    Developer
    Join Date
    Sep 2001
    Location
    The Bluegrass State Will Flash For Food
    Posts
    3,789
    or, if you want to change the color in-line, use htmlText...
    Code:
    _txt.html = true;
    _txt.htmlText = "<font color=\"#ff0000\">red text</font>";
    http://www.macromedia.com/support/fl...s/htmltext.htm

  6. #6
    Senior Member vucjak's Avatar
    Join Date
    Mar 2002
    Location
    BanjaLuka, RS, Bosnia
    Posts
    306
    Does it needs to be dinamicly created like
    _root.createTextField("_txt",1,50,50,200,100);

    and than
    _txt.textColor = 0x000000;
    to change color?

    if does, that does`t work..
    what is the proper way to use it?
    Last edited by vucjak; 02-24-2003 at 02:26 PM.

  7. #7
    Developer
    Join Date
    Sep 2001
    Location
    The Bluegrass State Will Flash For Food
    Posts
    3,789
    put a text field on the stage (this can be done dynamically, but you don't need to); give it an instance name (in my example I used _txt); see above...
    Last edited by gSOLO_01; 02-24-2003 at 02:30 PM.

  8. #8
    Developer
    Join Date
    Sep 2001
    Location
    The Bluegrass State Will Flash For Food
    Posts
    3,789
    quick example...
    Attached Files Attached Files

  9. #9
    Senior Member vucjak's Avatar
    Join Date
    Mar 2002
    Location
    BanjaLuka, RS, Bosnia
    Posts
    306
    thanks a lot now I get it...

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