Changing Color Of Text In String Variable
Hi, I have a variable called fx:
house = "The house is a big 4 room house. Read more";
okay, - then I have a dynamic text field where I want my text.
Okay my text field var is also called house and I get the text all right,- BUT
I want the 'Read more' part to have another color than the rest and also a link.
How can I do that???
Regards
Godowsky
FlashKit > Flash Help > Flash MX
Posted on: 08-23-2002, 05:53 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Changing Color In A Part Of Text String
Hello,
I'm sending a text string to a dynamic text feild and I need part of the text to be a seperate color. Is it possible to change part of the text to a specific color. Thanks.. Jacob
Changing Color Of Text That Is Variable
I am using Flash MX Pro. I have a movie clip with text loading from a variable.Is there any way to change the color of the text. i have tried everything and it seems to have no affect. One tutorial I read said to make sure the actionscript was in expert mode and how to do it. Problem is my version does not have that option.
If anyone can tiell me how to change the color of the text, I would be very grateful.
Taz
Changing The Color Of A String In A Textfield
Hello everyone,
Basically I have a dynamically created textfield in a movieclip. The text in the textfield is made up of two strings. I need one of these strings to be a different color.
Here the code:
Code:
//create textfield inside of MC and set attributes
_root["mc"+i].createTextField("txt"+i,200+i,0,0,500,400);
_root["mc"+i]["txt"+i]._quality = "BEST";
_root["mc"+i]["txt"+i].html = true;
_root["mc"+i]["txt"+i].multiline = true;
_root["mc"+i]["txt"+i].wordWrap = true;
_root["mc"+i]["txt"+i].embedFonts = true;
_root["mc"+i]["txt"+i].text = userEntry[i]+" -"+userName[i];
_root["mc"+i]["txt"+i].selectable = false;
_root["mc"+i]["txt"+i].setTextFormat(entryTextFormat);
i need userName[i] to be a different color than userEntry[i], without creating a new textfield. Can i embed some simple HTML to change the color? How do I do this if so?
Thanks for the help.
Changing A Variable From MovieClip To String
I have assigned a MovieClip as a variable so I can use the _x and _y properties
var correctAnswer:MovieClip = radio4;
but I also want to use the name of the instance in the following if/else statement
if (this._parent.radioGroup.selectedData == correctAnswer){
//do something
The problem comes from the correctAnswer being _level0.radio4 when all I need is Radio4.
Any clues on what a solution might be. I know my details are sketchy at best (I blame copious amounts of caffiene!).
Mike
Attach Code
var correctAnswer:MovieClip = radio4;
[MX] Changing A Variable Contents From A Number To A String
I have a variable called total.
The value of total is a random dollar and cents amount.
When I display the contents of the variable on the screen, (in a dynamic string) there is no comma separator at the 1,000 mark. How do I make the number show the comma separator? (I already have the string set to "$ "+total+"" which results in (for example) $ 52435.25
Please Help!
Thanks in advance,
Brian
Changing Button Color By Variable
Is it possible to change the color of a button depending on the value of a variable ? If so does anyone have a simple example of code ?
How To Store A String Plus A Variable In A Dynamic Text Variable?
Hi,
I've got a dynamic text field with the instance name rightAnswer_txt.
I declare the variable in the frame it resides in, with the following code var rightAnswer_txt:String = "";
Then, when I want to populate it using the following code:
rightAnswer_txt.text = "You scored " + rightAnswers;
the script comes out with an error saying ...
**Error** Scene=Scene 1, layer=actions, frame=7:Line 15: There is no property with the name 'text'.
rightAnswer_txt.text = "You scored " + rightAnswers;
Any idea what this means anyone please?
Text String Color Change
Can you change certain words color in a text string being sent to a dynamic text box, and how do you do it. I have a sentence, and I want to change the last three words to white instead of black. THanks,
Changing The Text Color
hi there,
has anybody an idea how to change the color of selected text in a textarea field.
or is it maybe absolute unpossible to do in flash 5
thanks a lot in advance,
arne
Changing The Color Of Text With AS
Hi there.
Is there any way of changing the color of a textfield using actionscript that doesn't involve putting the textfield inside a movieclip?
cheers
Changing Text Color
Hi all:
I have a menu of links in my Flash MX movie. All of the links connect to different areas within the movie; none of them call external HTML pages.
Each link is a dynamic text box covered by an invisible button. I use a script to populate the boxes. For example:
_root.linkText1.htmlText = "<u>File 1, Section 1</u>";
_root.linkText2.htmlText = "<u>File 1, Section 2</u>";
_root.linkText3.htmlText = "<u>File 1, Section 3</u>";
(Note that my code actually has proper HTML tags. This editor keeps literally formatting it, and I don't know how to turn the feature off.)
The links are colored blue, and I would like for only the visited links to change to purple. I can't get it to work.
I tried adding a property called "visited" to the Text Field class. At the beginning of the movie, I added a default property as follows:
TextField.prototype.visited = false;
When each link is clicked, this script runs:
_root.linkText1.visited = true;
_root.linkText1.htmlText = "<font color="#990099">File 1, Section 1</font>";
The link won't change to purple, though. Each time I return to the Menu, it's still blue, and the value of "visited" shows as false.
I have also tried creating and running a function to iterate through the links, but it doesn't work, either. I don't get errors--just no results.
Here's the function. I modeled it after an example in the ActionScript Bible:
fieldNames = ["linkText1", "linkText2", "linkText3", "linkText4", "linkText5", "linkText6", "linkText7", "linkText8", "linkText9", "linkText10"];
function checkFields(target, list){
var list = fieldNames;
for(i=0; i<list.length; i++){
currentValue = list[i].visited;
if(currentValue == true){
trace(currentValue);
}
}
}
The AS Bible didn't explain what the "target" parameter is used for.
Please help.
Changing Text Color
It doesn't seem to work
I have a function which argument is supposed to ) change text color of dynamic text named _root.where
This is the function
function changecolor (colorr) {
text=new Color(_root.where);
text.setRGB(color);
}
and button which gives this action
on(release){_root.changecolor(FF0000);}
But my dynamic text does not change color.
What am i doing wrong, is it even possible to change color of dynamic text?
P.S. Text is black and it's in _root.
Thanx
Changing Text Color. Help?
I am making a 'dress-up' game and one of the fields is 'Emblem.' For one of the emblems, there is a text box where you type in a character the press submit and it shows up as the persons shirt mark. I was thinking, and now wondering, if there's a way to change the text color with an action and without breaking apart the text. Help would be greatly appriciated.
Changing The Color Of Text
Hi, I am tring to change color of text..
the thing is ,if the answer is true then the color=blue else it is red
how do I modify the code ?
thanks
PHP Code:
_root["sonuc"+i].htmlText='<font color="blue">good job</font>';
Changing Text Color With XML
Greetings Everyone,
I have been tasked with creating a dynamic banner. The banner loads text from an XML File. I have been able get text boxes to displaythe text. However I am trying to change the color of the text. I am trying to put the value of '0xFF00CC' which is loaded from the same XML file as the banner text. When I try to place that number into a variable and then trace the variable it is coming back 'undefined'.
Any help would be greatly appreciated!
Jesse
Changing Text Color
I am attempting to change the color of text on a mc during mouse over. The mc is dynamically created with XML and is being used as a button. I am at a loss. I have an event listner for the mouse over state however I can not get the text color to change with the mouse over. The mouse over is functioning properly, as I have other events being triggered the work.
Any help will be greatly appreciated.
Changing Text Color
This actionscript isn't changing the text color on rollover, what am I doing wrong?
ActionScript Code:
button.txt.text = "Back to Gallery";
button.onRollOver =function() {
var rolloverTxt = new TextFormat();
rolloverTxt.color = "0xFFCC00";
this.txt.setNewTextFormat(rolloverTxt);
}
Changing Text Color
I am using a countdown clock and would like to know how to change the color of the text based on the time on the clock. For example every time it hits 10 whether its in ms, sec, min etc. I would like the text to change from yellow to red then when it gets past zero I want it to reset to yellow. Any ideas on how to do this?
Thanks
Help With Changing Text Color
ok, so this is for a baseball leauge that i take part in. They wanted to do a live update thingy on there site. What i want to do is make it so that when the game status variable = final then the text color changes of the team that lost.
Code:
onClipEvent (enterFrame) {
if(_root.game_status == "Final"){
if(_root.home > _root.away ){
format = new TextFormat();
format.color = 0xFF3366;
hteam.setTextFormat(format);
}else{
format = new TextFormat();
format.color = 0xFF3366;
ateam.setTextFormat(format);
}
}
}
That is what i have so far for it, but i cant get it to fit all together and actually work. Hopefully i explained it well enough, sorry bout that. thanx for any help that you can give me...
Changing Text Color With AS
Is there a way you can change a text objects color with AS? For example… Giving the text object the instant name: “my text”. Then changing the color of that instant name??? The way I have been doing this in the past is by making the text object a movie clip and just making a second key frame with the second color. However this means I now have a lot of movie clips floating around.
- Thank you very much.
? Text Color Isn't Changing?
I have created a simple countdown clock. I know that I can set the textfield color to red by simply selecting it and using the property inspector, but I want to change the color using actionscript.
I tried using
Textfield.textColor = 0xFF0000;
but for some reason the text isn't changing.
why?
Let me know what i'm doing wrong
Thanks,
Sam
Changing The Color Of Text In A Dynamic Text Field?
Any ideas how I can change the color of a dynamic text field when a button is pressed. I have tried everything but nothig seems to work. Any ideas appreciated :-)
but.onPress = function (){
change = new FStyleFormat({textColor:0x8D0101});
change.dytext.applyChanges();
}
Changing The Color Of A Text Using Actionscript
Hi !
Is it possible to change the color of the text through action script ? (If it's not possible in straight way, then using any trick like putting the text in a movieclip & then changing the color of the movie clip etc.)
Mahesh
Changing Dynamic Text Color On The Fly
How do I change dynamic text color on the fly? I can change an objects color, what about dynamic text if say a value returned is below a certain value?
Thank you,
Shane
Changing Text Color...Dynamically
Hi ----
Is it possible to change the color of a text field dyanamically thru DHTML....that is passing a variable from javascript to flash that will change the color of the text.
Thanks for any and all responses.
Regards.
SDL
Changing Combobox Text Color?
changing combobox text color?
thank you for reading this post and for any assistance provided.
My question is simply how to change the text color in the comboxbox.
Ive tried a few things, but none have seemed to work.
thanks in advance.
Changing Text Color Dynamicly?
Is there a way in F5, through ActioScript, to change the color of a font contained within a dynamic text field?
For instance, if I have on my stage a text field with a variable name of "link1", I'm wondering if I can on(rollOver)change my font color from say #999999 to #00FF00. Maybe through set property?????
Changing Color Of Input Text Box?
Is it possible to change the color of an input text box with using actionscript??
I really dont know if its possible. I just guessed and tried stuff like
message.color = "#FF00FF";
message being the variable name
I am also using Flash 5.
Changing Color Of Dynamic Text
I have a dynamic text box and two button. The buttons are: red and green. When I click red, the word "red" is printed in the box, and when green is clicked, "green" is printed.
The text box adds words. If I press red 4 times and green 3 times it would say:
"red red red red green green green"
Now, I want the red words to be printed in red, and the green words in green.
My code is the following (note the text box is named history text):
on (release) {
_root.historytext.textColor = ("0x990000");
_root.historytext.text = _root.historytext.text+ "
" + "red"
}
on (release) {
_root.historytext.textColor = ("0x0CC000");
_root.historytext.text = _root.historytext.text+ "
" + "green"
}
The problem with my code is that the entire text color in the box is changed. I need it so that when I add a green word, it is green, and a red is red.
THANKS!
Changing Dynamic Text Color
Hello. I'm having a problem with changing the color of text in a dynamic text box and making it permanent. Here's the code I'm using:
Code:
fmt1 = new TextFormat();
fmt1.color = 0xff0000;
_root.myText.setTextFormat(fmt1);
This code works fine up until the point that I change the text! I'm just wondering if there's a way to make it permanently red, or any color for that matter.
Changing The Color Of The Layer Name Text
Anyone know how to change the color of the text that is used for the layer names in the authoring environment?
I somehow changed mine to white and now i can't see the layer names!
XML, Color Changing And Text Formatting.
If I've got a flash document that I'm bringing in XML information, into a running text block, is there a way for me to format the text at all?
can I add tags that will then change the color of the text, but only on items between the two tags.
I really don't have the ability to adjust the Flash document to have multiple text boxes to change the color, it has to be a big running block of text.
Any possibilities?
Thanks Thanks.
Changing Color In A Text Field?
I've created a scrolling text field and it works fine but...
...how can I have certain lines of text be a different color, such as headings? When I change the color of one line, all the text's color changes. Thanx.
Changing Text Fill Color...
I am trying to create an effect where you rollover a text, and the text changes color. I tried the "setTextAttr" Property, but I don't think I am using it correctly. Anyone got any tips?
Thanks a lot.
Changing Dynamic Text Color
Hello all,
I have a quick question. I have an array made up of nodes pulled from an XML file. Is it possible to change the text attributes (i.e. color or alpha) of one of these chunks of text.
So a very typical situation. XML is loaded into arrays. The text is loaded with a for loop into an empty movieslip. Looks like this:
text_obj.xmlNode1[n]
So lets say I want to do something to the color of array position 1. I set up a little function....
dummyButton.onPress = function(){
text_obj.xmlNode1[0].color = 0xff0000;
}
Seems like it should work, but doesn't Can I do this with dynamic text? Is there a workaround? I basically need to call out portions of the text during an animation. Think animated text highlighting.
Thanks!
CreateTextField And Changing Text Color
What im trying to do is: have a dynamically created text field change color when i roll over a movieclip.
This is what i have:
a movie clip with this code:
Code:
this.createTextField("header", 99, 10, 10, 100, 300);
header.autoSize = true;
header.embedFonts = true;
var my_fmt:TextFormat = new TextFormat();
my_fmt.size = 50;
my_fmt.color = 0x9A9A9A;
my_fmt.font = "Impact";
header.setNewTextFormat(my_fmt);
Now 2 instances of this moveiclip are placed inside another movieclip. Each one showing a different text. (these instance are to act like buttons)
INSTANCE 1:
Code:
onClipEvent (enterFrame)
{
this.header.text = "SOUP";
}
INSTANCE 2:
Code:
onClipEvent (enterFrame)
{
this.header.text = "PIZZA";
}
The dynamically created textfield (lets call it "header") works fine. However, i cannot seem to get the text field to change color once you roll over the instances. I've tried using "
Code:
on (rollover) {
this.header.textColor = 0xFFFFFF;"
}
, but no such luck....can anyone point me in the right direction.
Thanks.
Changing Text Color Through ComboBox
Hi,
I'm trying to develop a word processor in Flash. I have a ComboBox component, which has a list of colors like Red, Blue, etc. I also have an Input textbox, whose text colour i want to change based on the colour selected from the ComboBox. I'm using the following code but am not getting the result i want. Can anyone help ?
//cd is the name of the ComboBox
if (cb.selectedItem=="Red"){
// txt is the instance name of the movie clip containing the input text dt
myColor = new Color(_root.txt.dt.text);
_root.txt.dt.setNewTextFormat(myColor.setRGB(0xFF0000));
}
Changing Text Color With AS. Big Headache
I am having a hell of a time trying to get text to dynamical y change color. Here is the code that is giving me hell in its most basic form, I think it is pretty self-explanatory:
Code:
textbox.text = "hello";
newTextStyle = new TextFormat();
newTextStyle.color = "0xFF0000";
textbox.setTextFormat(newTextStyle);
Changing Text Color W/ Actionscript
Hi,
I am looking for a script that I can attach to a button that will then change the text (inside a dynamic text box) to a specified color. So, when I click the mouse on the button, the text in the dynamic text field will change to the color that I have specified in the script. Thanks so much for your help!
Changing Root Variable With Text Variable
Simple question: I'm trying to change the value of a variable on the _root level (called "myVar") to whatever a user types into a text box (mytextvar) on the stage. I have a button that says:
ActionScript Code:
on (press) {
_root.myVar = _root.myTextVar;
}
It isn't working... any ideas how to make this work?
Changing The Text Color On A Radio Button
Does anyone know how to change the color of the text on a radio button? the default black text does not show up very well on my movie background. I would like to change it to a gray color but can not figure out how. If anyone knows how to do this please let me know. thanks.
Changing Text Field Color On Focus
Hi there,
Is there a way to change the border and background color of a text field when it is focused on?
I know:
txtField.borderColor = 0x999999;
txtField.backgroundColor = 0xE3E3E3;
But how do I trigger it to change the color when the user clicks on the field?
Thanks!
[CS3] Changing Text Color In List Component?
Hallo,
Just switched over to CS3, still adjusting to the many many changes.
How on earth do you change the text color styles of a List component in AS3? I know it was easier to directly access the .color, .rollOverColor properties in AS2, but I can't find *ANY* comparable feature in AS3. I can see how everything else is skinned, by navigating the layers of symbols within the component. Can anyone help me, or explain how I'm thinking about this wrong?
Thanks,
Dylan
Changing Text Color In List Components
Hallo,
Just switched over to CS3, still adjusting to the many many changes.
How on earth do you change the text color styles of a List component in AS3? I know it was easier to directly access the .color, .rollOverColor properties in AS2, but I can't find *ANY* comparable feature in AS3. I can see how everything else is skinned, by navigating the layers of symbols within the component. Can anyone help me, or explain how I'm thinking about this wrong?
Thanks,
Dylan
|