Forum Discussion
Using states to create select and deselect
How do I set my triggers to make an object appear selected when clicked once and normal when clicked again?
Cant seem to get it to work 
22 Replies
Michael,
That's a tough egg to crack. If you only use triggers, it's not going to work because both triggers are associated with the button and both fire each time you click. Hence, they interfere with one another. To do this, you'll need a little variable helper and some cool coding.
Get ready to Toggle your Variable!
I've attached the sample on how you accomplish this.
Mike
- EstherRamiri227Community Member
Thanks Mike! I know this post has been around for 8 years and I was excited to find it along with your example. I believe you just saved me hours of useless trigger programming!
I hadn't even thought about using a variable. It all makes sense now. It worked out and now I have a beautiful working slide.
Thank you!
Hi Esther,
That's wonderful! I'm glad it's still helping. I would, however, point out Phil's comment. You may not need the variable.
Mike
- DyaneEspinosa-bCommunity Member
Wow!!!! This was posted 8 years ago, but it is working perfectly for me now in quarantine 2020!
Thanks
Dyane
- JamieMorganCommunity Member
I'm not sure if there is functionality in the triggers to accomplish that. I'll let others weigh in though.
As a work-around, you could use a slide layer that contains the same object with the "selected" state. When the user clicks the object on the base layer, simply show the selected layer (which is nothing more than the same object with some indication that it's selected). On that selected layer, have a trigger that hides the layer when the user clicks on the selected object. In essence, you'd be toggling the selected layer on and off to simulate the click once to turn on, click again to turn off effect.
- JamieMorganCommunity Member
I like Mike's way much better. Thanks for that MIke - that will simply some of my building for future projects.
- MichaelRice-a6eCommunity Member
That is great! thank you again.
- MichaelRice-a6eCommunity Member
Your fix is working really well.
Is there a way to make that on/off status reflect to another object on another slide? i.e.
To use your example:
When I select the rectangle and change its state, can I have that state reflected in a "mini rectangle" on another slide.
Is that some sort of call to the variable?
Thanks in advance!
Michael,
Variables are carried across slides and their status can always be called. So let's say you have a rectangle on slide 429, all you have to do is add a trigger on that slide that says change state of object X when timeline starts if variable is.....
Mike
- MichaelRice-a6eCommunity Member
In between the time that I wrote and the time you responded the scales fell from my eyes.
I select it on one slide, it shows what I selected on another and displays that in a chart.
I will put up a demo when it is complete and scoured.
Thanks for your help. I just needed a push to turn the engine over!
- PhilMayorSuper Hero
I may be getting the wrong end of the stick, but if you give an object a selected state and dont associate it with a button set, it will toggle between selected and normal without doing any work or use a variable
D'OH!
Phil is right. And that's sooo much easier!
Sorry for the overly complex solution Michael! I got all caught up in variables, etc.
- PhilMayorSuper Hero
Mike loved your example, may get me out of a hole one day
Related Content
- 5 months ago
- 5 months ago