|
-
Senior Member
MX2004 - "font color" property not working in loop populated text field
Hi,
I have the following script which works fine in the "Text Area" component of MX2004:
code: _root.dym_txt.html = true;
_root.trink_array = ["Carp", "Cod", "Bream"];
_root.trinity_array = new Array();
for (var g = 0; g<=2; g++) {
_root.trinity_array[g] = _root.trink_array[g];
some_str += "<br>"+_root.trinity_array[g]+"</br>";
}
_root.dym_txt.text = some_str;
However, if I try & change the “color” property instead of just putting a break <br> in the text Flash throws it’s toys out of the pram & wont let me use the code to obtain this:
_root.dym_txt.html = true;
_root.trink_array = ["Carp", "Cod", "Bream"];
_root.trinity_array = new Array();
for (var g = 0; g<=2; g++) {
_root.trinity_array[g] = _root.trink_array[g];
some_str += "<font color="#92A312">"+_root.trinity_array[g]+"</font>";
}
_root.dym_txt.text = some_str;
The error message:
**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 7: Unexpected '}' encountered
}
Comes up?
Any help please.
You will know everything when you know you never will.
-
Instead of double quote marks, try using single quote marks around the color number...
Code:
_root.dym_txt.html = true;
_root.trink_array = ["Carp", "Cod", "Bream"];
_root.trinity_array = new Array();
for (var g = 0; g <= 2; g++) {
_root.trinity_array[g] = _root.trink_array[g];
some_str += "<font color='#92A312'>" + _root.trinity_array[g] + "</font>";
}
_root.dym_txt.text = some_str;
-
Senior Member
Thanks dawsonk I will give that a go.
Enjoy the rest of your day!
You will know everything when you know you never will.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|