Triggers and Returning to Normal State
Mar 07, 2013
I am trying to create two triggers for one shape - where when the user clicks the shape the first time, it changes states to "new state" and when they click it a second time, it changes back to normal. I've given the shape two triggers, both with conditions. The first trigger is "change state of Rectangle 1 to New State when User Clicks Rectangle 1 with the condition that Rectangle one's state is equal to Normal." and the second trigger is "change state of Rectangle 1 to Normal when User Clicks Rectangle 1 with the condition that Rectangle 1's state is equal to New State." However, this is not working. The first trigger will work on its own, but as soon as I add the second trigger, nothing works. What else do I need to do to make this work?
36 Replies
You may need to use a varible to trigger the second change. A simple number variable should work.
Okay, the above answer works if I want the shape to revert back to its normal state once.
Some clarification: I want the shape to switch back and forth between the new state and the normal state each time the user clicks on it.
Any help with that?
I used two shapes and took advantage of layering in the timeline to do what you want.
Take a look at the triggers. Also look at the states of the first shape. I think this will work for you.
Are they leaving hte slide when the button is pressed? If they are, you could just have the slide return to initial state upon return
NVM, after I thought about it, I do not think that will accomplish what you want.
This is a lot of triggers, but it works....depends on how many times they need to press the button.
Thank you all for your guidance and help. Garth's idea of using layers and two different shapes absolutely accomplishes what I want.
Very simple Garth. Great job!
Here is a couple of examples of the ways I change states using variables.
The first example uses three triggers and a True/False variable. The variables value is toggled with a NOT assignment every time the shape is clicked. The shape is then set to the correct state based the true/false value.
The second example uses a number variable and six triggers (two triggers plus a trigger for each state to cycle through). Each click increments the number variable by 1. The number variable is then checked to see if it exceeds the number of states and if so resets to 0. The shape is then set to the correct state based on the number value.
Why not just give the shape a selected state this will toggle no triggers needed
I hadn't thought of a selected state to toggle between two states. Great suggestion. Most of my cycling through states have involved more than 2 states, so the selected state wouldn't work. I use Example 2 in my above .story submission.
Hi Philipp What do you mean? I had a shape with a selected and normal state and it doesn't toggle automatically. When I added a variable as suggested above, I was able to toggle.
Helene,
Did you create triggers to change the state? If so, your triggers would conflict with the built-in triggers, with unpredictable results. Try it with just the built-in triggers.
I removed my triggers but initially yes I had some. Now it works with just a variable that I toggle for all my shapes. If I remove it it doesn't work.
My comment probably wasn't complete enough.
If you have a state named "Selected", it should work without triggers or variables. If you write your own triggers, you will need a variable and a state with a name that is not one of the built-in states.
You were clear ;-) Yes it should work, I agree. It was working to go to the selected state, but not going back to Normal on click again.
Hi All,
I have here a sample on how to Toggle a Button States.
I think this is the shortest and efficient way of doing.
In Programming we used the NOT operator.
Hope this helps.
~rex
Rex,
See if Phil's idea might be easier and faster.
Hi Rex, yes this works as you demonstrate, but what Walt is suggesting is that you don't need a trigger or a variable to toggle a button with default states.
Hi,
Yeah, I know that there is a Selected State as I usually do add Selected State when using "Button Set" to group buttons.
Since the author is asking a Triggers, then I'm producing a sample that is uses Triggers.
Walt is correct you don't need a variable to toggle a button if you use a selected state without a button set it will toggle, however using a visited state as well will likely break this.
Sent from my iPhone
OK I know where the confusion is coming: it works for a BUTTON, but not for shapes!
It will work on a button or shapes or images they all behave the same
mmm I just tried with a blank page and indeed it works! So I need to figure out why it doesn't work on my screen where I have an activity of selecting the shapes as part of a quiz.
Is it multiple choice? I expect you gave a button set assigned.
Sent from my iPhone
This discussion is closed. You can start a new discussion or contact Articulate Support.