How do you make it so whenever you click a button again it changes the background image until three times?

When i click a button, it changes the background image to image_x, then if you click it again then it changes to image_y, and for the third time it becomes image_z. Can someone guide me through it?

Name all your images 1.jpg, 2.jpg, 3.jpg, 4.jpg etc...then make a global variable "index=1". When you click the button, set the image to "index" +".jpg, then increment the index by 1. From now on, index is 2, next time you click the image index(2).jpg will appear.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.