Changing a shape state on condition of the shape's state

Hi all.

I wasn't sure exactly how to word this one when searching for an existing discussion, so apologies if there's already a discussion about it.

I want to have a shape that starts without any text in it, and each time the leaner clicks it, the text changes to 1, then 2, then 3, then 4, then 5, then back to 1, then 2 again, etc. Here's what I've done to attempt to achieve this:

Created a shape with 6 states:

  • Normal - no text
  • 1 - Shape with text saying '1'
  • 2 - Shape with text saying '2'
  • 3 - Shape with text saying '3'
  • 4 - Shape with text saying '4'
  • 5 - Shape with text saying '5'

Added 5 triggers to the shape:

  • Change state of oval to state '1' when user clicks oval IF oval's state is 'Normal'.
  • Change state of oval to state '2' when user clicks oval IF oval's state is '1'.
  • Change state of oval to state '3' when user clicks oval IF oval's state is '2'.
  • Change state of oval to state '4' when user clicks oval IF oval's state is '3'.
  • Change state of oval to state '5' when user clicks oval IF oval's state is '4'.
  • Change state of oval to state '1' when user clicks oval IF oval's state is '5'.

However, it's not working. The first time it's clicked it changes to state '1', but then won't change again. I thought it might be getting confused about having two triggers telling it change to state '1', so I deleted the last trigger (Change state of oval to state '1' when user clicks oval IF oval's state is '5'.) When I did this, it changes to state '5' after one click and won't change again.

Anyone got any idea why what I'm trying isn't working? I know a workaround could be to create a textbox for each number that starts hidden and appears with each click based on a variable, but I'm wondering why what I'm trying doesn't work.

EDIT: Just had a thought - is it because all of the triggers are happening at the same time, so it's instantly going from 1, to 2, to 3, to 4, to 5, back to 1 after a single click?

Thanks.

2 Replies
Ned Whiteley

Hi Astutis,

The solution is a simple one (see attached file). I have added a variable called ButtonCount that counts up to six by adding one to the variable every time the shape is selected. When ButtonCount is equal to one, the state of the shape changes from Normal to State 1. When ButtonCount is equal to two, the state changes from State 1 to State 2 and so on until it reaches State 5. The next time the shape is selected, ButtonCount changes to six, which resets ButtonCount to zero and then resets the shape to Normal. The whole process then repeats itself.

Hope this helps.