Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7008207
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:42:18+00:00 2026-05-27T21:42:18+00:00

Is it possible to have two text colors in one text field using Actionscript

  • 0

Is it possible to have two text colors in one text field using Actionscript 3.0?

ex: how can i make like the first string black and the second string red?

Here is my code when using a single color:

    public function logs(txt)
    {
        if (txt == '')
        {
            textLog.text = "Let's Open up our treasure boxes !!!";
        }
        else
        {
            textLog.text = '' + txt + '';
        }
        textLog.x = 38.60;
        textLog.y = 60.45;
        textLog.width = 354.50;
        textLog.height = 31.35;
        textLog.selectable = false;
        textLog.border = false;
        var format:TextFormat = new TextFormat();
        var myFont:Font = new Font1();
        format.color = 0x000000;
        format.font = myFont.fontName;
        format.size = 18;
        format.align = TextFormatAlign.CENTER;
        format.bold = false;
        textLog.embedFonts = true;
        textLog.setTextFormat(format);
        this.addChild(textLog);
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T21:42:19+00:00Added an answer on May 27, 2026 at 9:42 pm

    In setTextFormat you can specify start index and end index. You can also render text as html using textLog.htmlText.

    First set the text

    var t:TextField  = new TextField();
    t.text = "BLUEGREEN";
    addChild(t);
    

    Then method 1

    var format1:TextFormat = t.getTextFormat(0, 4);
    format1.color = 0x0000ff;
    t.setTextFormat(format1, 0, 4);
    
    
    var format2:TextFormat = t.getTextFormat(5, t.length);
    format2.color = 0x00ff00;
    t.setTextFormat(format2, 5, t.length);
    

    Or method 2

    t.htmlText = '<font color="#0000ff">BLUE</font><font color="#00ff00">GREEN</font>';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible stupid question: let's say I have two apps contained within one project. Can
I have a batch script that can display two or more colors of text
Is it possible to have two background images? For instance, I'd like to have
Is it possible to have two app.config files where one app.config serves as a
I have two possible widths for a string i want to display in a
Possible duplicate : comparing-two-arrays I have two NSArray and I'd like to create a
I have two images that are of same size and text but different colors
Possible Duplicate: How can I lock a file using java (if possible) I have
I have two input textareas, and the second one is hidden. Is it possible
Is it possible have two projects with the same name in flex builder? Here

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.