Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Click to change color of field

Not applicable
When a user clicks a field I want the color to change. Each click will result in a different color (of 5). I assume I need an array but am currently unable to get it to work.

I have the following code on a mouseUp:

function changeColor()


var changeColor= new Array(5)






var x=0;

for (x=0; x<5; x++)


TextField1.fillColor = changeColor[x];}

7 Replies
Level 10
Level 10
Found your issue .....x and y are reserved expressions (used to define the location of the field). Change it to i and it will work just fine.
Not applicable
Hmm...still not working. Any more thoughts?
Level 10
Level 10
Worked for me your email address and I will send you a sample.
Not applicable and thanks!
Not applicable
Hmm. It changes to one shade of green and doesn't change again. So for you it changes color on each click? What am I doing wrong here?
Level 10
Level 10
Its running through all 5 colors in the array and the last one is being displayed. It is not setting it to the 0 color on the 1st click etc...