Solved

Change color of dynamic text header with ActionScript

Posted on 2004-09-29
8
219 Views
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
or
header.text.color = FFF0000
would work but it doesn't.
Thanks
Charles
0
Comment
Question by:grinchikins
  • 3
  • 3
  • 2
8 Comments
 
LVL 6

Expert Comment

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

Assisted Solution

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

_root.Text1.textColor = 0xFF0000;
0
 

Author Comment

by:grinchikins
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.
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 39

Accepted Solution

by:
blue-genie earned 25 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.
blu.

0
 

Author Comment

by:grinchikins
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).
0
 
LVL 6

Expert Comment

by:nishasrilankan
ID: 12206778
Check your publish settings...

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

Expert Comment

by:blue-genie
ID: 12215083
are you developing for flash 5 player?
0
 

Author Comment

by:grinchikins
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.
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

This is a very simple example to help those of you who are still migrating from AS2 to AS3 understand the redesigned event model in AS3. In AS2.0, event functions (that is, the function to be performed when an event is fired) were stored as a pro…
I know the transition can be hard. We got used to the ease of use ActionScript 2 had, but honestly, it became problematic later on, especially if designers were involved in the project and found it easy to add code as they saw fit. So, this artic…
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.
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.

813 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now