Change color of dynamic text header with ActionScript

Posted on 2004-09-29
Medium Priority
Last Modified: 2010-04-03
Hi there,
I have a header which I want to change the color of, depending on which variable is imported, using ActionScript.  I have a dynamic text box named variable "header" which I can alter the text of by simply using: header = "this page" but I cannot seem to change the color.  I would have thought that simply adding:
header.color = FF0000
header.text.color = FFF0000
would work but it doesn't.
Question by:grinchikins
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2

Expert Comment

ID: 12187048
header..textColor = 0xFF0000;
 //remove the "." between text & Color...

Assisted Solution

nishasrilankan earned 100 total points
ID: 12187074
give an Instance name to the TextBox...say Text1,

_root.Text1.textColor = 0xFF0000;

Author Comment

ID: 12192142
Sorry,  tried that and it doesn't work.  I already have the instance name working for putting in text. At the moment:

Text1 = "\"A\" Companies"
Text1.textColor = 0xFF0000;

Shows "A" Companies - text that I want, but the color remains the same as entered in the text box not 0xFF0000.
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 39

Accepted Solution

blue-genie earned 100 total points
ID: 12198277
grinchikins, i suspect you dont' have an instance name given to your textfield, (bottom left corner of the properties window when you select the text field on the stage), but rather you have assigned a var value to it (on the bottom right), the reason I say this is

if your textfield had a textfield instance name of Text1, your script would have to read

Text1.text =  "\"A\" Companies"
 therefore, leave the variable as Text1 or header, and give it a different instance name.

for example, if your var value is "header" and the instance name is Text1, then your code will read as follows:

header = "\"A\" Companies";
Text1.textColor = 0xFF0000;

thats all.


Author Comment

ID: 12203262
I have tried that, but all it does is give me dire warnings in both a popup and the output window that this feature is not supported in the Flash 5 Player.  Still doesn't change the color.  I am using Flash MX, by the way (not 2004).

Expert Comment

ID: 12206778
Check your publish settings...

Select the flash player version heigher than version 5...
LVL 39

Expert Comment

ID: 12215083
are you developing for flash 5 player?

Author Comment

ID: 12226873
Okay, so you're both right.  Now I don't know who to give the 50 points to.  I initially was developing this for the Flash 5 player because I started this project so many years ago I was concerned that not many people had upgraded to the Flash 6 player but I assume I should forget about that now.  I guess this couldn't be done before MX.  Seems silly that you couldn't attach an instance name to dynamic text.

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I come across a lot of question about how to access things in the document class from a movieclip, or accessing something from a movieclip in the document class. It took me a while to figure this out but once I did it makes life so much easier. …
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question