The Armor Games website will be down for maintenance on Monday 10/7/2024
starting at 10:00 AM Pacific time. We apologize for the inconvenience.
The Armor Games website will be down for maintenance on Monday 10/7/2024
starting at 10:00 AM Pacific time. We apologize for the inconvenience.
1 | 3693 |
I am trying to make dynamic text change colour using the code below. Basically, I am trying to make it so that, if the same "Relationship -5" message flashes twice, the second time it will be a different colour.
However, when the second message goes through, I get this error on the Output panel:
ReferenceError: Error #1069: Property color not found on flash.text.TextField and there is no default value.
Here is the code I have on the main timeline, and underneath is the rest of the code from inside an object:
var relationshipTextColor1:ColorTransform = new ColorTransform();
relationshipTextColor1.color = 0x330066;
var relationshipTextColor2:ColorTransform = new ColorTransform();
relationshipTextColor2.color = 0xCC3300;
if
(MovieClip(root).relationshipTextOne.text == "Relationship -5" && MovieClip(root).relationshipTextOne.color == MovieClip(root).relationshipTextColor1)
{MovieClip(root).relationshipTextOne.transform.colorTransform = MovieClip(root).relationshipTextColor2;
MovieClip(root).relationshipTextOne.text = "Relationship -5";
} else {
MovieClip(root).relationshipTextOne.text = "Relationship -5";
MovieClip(root).relationshipTextOne.transform.colorTransform = MovieClip(root).relationshipTextColor1;}
I believe the problem is in the first part of the 'if', at 'MovieClip(root).relationshipTextOne.color'. What am I doing wrong?