Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Changing Dynamic Text Field Color

New Here ,
May 09, 2008 May 09, 2008
Is it possible to change the color of a dynamic text field through Actionscript? I'm using 2.0. I know how to change a button or mc color, but not a text field. The text field is currently defined as a string. Thanks.
TOPICS
ActionScript
885
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , May 09, 2008 May 09, 2008
The color of the string text displayed can be modified, but not the color of the string. Strings are pretty much just arrays of characters... aka data. To view a string on the stage it needs to be placed in a TextField. The TextField is the place where the visual attributes of a string are managed (font, size, color, etc).

Textfields have numerous properties, one of which is the text. The text property is assigned the string value that you equate it to.

TextField.text = String

Translate
LEGEND ,
May 09, 2008 May 09, 2008
Yes it is possible, but what do you want to change, the text color or the text field background color?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 09, 2008 May 09, 2008
Just the text color. The text background should stay transparent.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 09, 2008 May 09, 2008
Try:

tField.textColor = 0xFF0000; // red text

where tField is whatever instance name you gave to the TextField
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 09, 2008 May 09, 2008
It gives the error: "There is no property with the name 'textColor.'"


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 09, 2008 May 09, 2008
The "tField" in my example is not the text string, it is the text field instance name. In what you did you are trying to change the string itself, which does not have a textColor property.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 09, 2008 May 09, 2008
Does a string have anything equivalent to a textColor property or can its color not be modified?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 09, 2008 May 09, 2008
The color of the string text displayed can be modified, but not the color of the string. Strings are pretty much just arrays of characters... aka data. To view a string on the stage it needs to be placed in a TextField. The TextField is the place where the visual attributes of a string are managed (font, size, color, etc).

Textfields have numerous properties, one of which is the text. The text property is assigned the string value that you equate it to.

TextField.text = String

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 09, 2008 May 09, 2008
LATEST
Thanks for your help. This got me where I needed to be. Awesome!
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines