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

  • SEARCH
  • Home
  • 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 7825943
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T09:12:42+00:00 2026-06-02T09:12:42+00:00

how can I dynamically change some word color in spark component TextArea. For example,

  • 0

how can I dynamically change some word color in spark component TextArea. For example, I want in text “A quick brown fox jumps over the lazy dog.” word “dog” to be red color and word “fox” green.

<s:TextArea textFlow="{scriptTextAreaTextFlow}" change="{doSomething(event)}" text ="A quick brown fox jumps over the lazy dog." id="tarea1"/>

On every change function doSomething is called, she finds every positions of word “dog” and every positions of word “fox”. All I need to do is to dynamically change color of those words. In mx it was easy with TextRange.

tr = new TextRange(tarea1, false, start, end);
tr.color = "#00FF00"

Now, in spark I found a way to color it with TextFlow

scriptTextAreaTextFlow = TextFlowUtil.importFromString(resoult);

where “resoult” is HTML code generated based on text from TextArea, so words dog and fox are colored. The problem is that checking (and coloring) is done live (onChange) and after every

scriptTextAreaTextFlow = TextFlowUtil.importFromString(resoult);

TextArea anchor is moved to position 0(start). Only way i found to solve this is to remember anchor position before edit and set it after coloring but I’m searching for better solution.

Please help…

Thanks

  • 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-06-02T09:12:52+00:00Added an answer on June 2, 2026 at 9:12 am

    Another approach would be to trap the onChange and use a regular expression to change the HTMLText around your keywords to include the ‘font color=’ designations.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to monitor object creation. For example, I want to dynamically change some
I have a Query that the datasources it is set to can change dynamically.
I have some flags I store in my mysql database so I can dynamically
I just would like to know how can I dynamically change a label's values
I have one main form, and i want to dynamically change it's content, via
I want to dynamically change the caption on a TButton . The problem is
I'd like to dynamically change some of the standard JS DOM objects from within
Trying to dynamically change the message of an AlertDialog. For some reason I get
How can I write a script that will change an input field's text value,
I dynamically change DOM on client-side to add some new input fields using JavaScript.

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.