Use one button to show multiple layers

Mar 07, 2024

Hello all!

As a new Storyline user, I feel like I'm missing something simple, but I just can't figure it out. I've set up a slide with a button that I'd like to use to show multiple layers. The learner would click the same button to show a total of 7 layers. How do I do this? Thank you all in advance for any advice!

8 Replies
Walt Hamilton

You need to keep track of which layer is showing, so the next click shows the next layer. Keeping track of things is what variables do.

Create a  variable (numeric or text, but you will likely be tempted to take shortcuts that can mess things up if you choose numeric). You might call it layerOpen. Set its default value to 0. Create triggers for the button. You’ll need one for each layer. They look like: “Show Layer1 when user clicks button if variable layerOpen = 0”. The next one is “Show Layer2 when user clicks button if variable layerOpen = 1”, and etc. Then on Layer1, put this trigger: “Adjust (set) variable layerOpen to 1 when timeline starts on this layer”, and etc for each layer.

If I were doing it, I would give the button seven different states, so the learner would know where they are. That would require seven more triggers for the button, like this “Change state of button to state1 when user clicks button if variable layerOpen = 0”, and etc.

Charly Taylor

Hello Walt - thank you very much for your help! Unfortunately, your suggestions aren't working for me. Variables have remained a stumbling block for me, so it's likely something that I'm doing wrong. I've attached a copy of the slide I'm referring to. Would you mind to take a look at it and see what I'm doing wrong? Thanks again!

Jürgen Schoenemeyer

you have a problem with the trigger in the layer, not with the variables*

change the trigger in all layer from

When the timeline starts on this layer

to

When the timeline reaches time 0m 0.25 s

now it's working

 

* all trigger are fired with one use click direct after another

Jürgen Schoenemeyer

this is are your trigger on the main layer

 

original: on timeline starts

if user click 1x on "Button Right"

  • main layer trigger (for value 0) fires
  • layer 1 open, on timeline starts -> set value to 1
  • main layer trigger (for value 1) fires
  • layer 2 open, on timeline starts -> set value to 2
  • ...
  • layer 7 open and visible

 

fix: timeline reaches time 0m 0.25 s

if user click 1x on "Button Right"

  • main layer trigger (for value 0) fires
  • layer 1 open and visible
  • main layer trigger (for value 1) does not fire
  • ...
  • main layer trigger (for value 2) does not fire
  • layer 1 at 0.25 sec ->  set value to 1 (ready for the next user click)

 

 

 

Walt Hamilton

You ask:

Just for my own knowledge, why did that fix it? I don't understand the difference between having the layer show when the timeline starts versus at 0.25 seconds. It seems like it would work either way (but obviously not). 

It isn't a question of when the layer shows, it is when the variable changes. It does work either way. It's just that without Jurgen's delay, it opens all the layers too fast for you to see them. When you have a list of triggers associated with one action, the action causes the whole list to be executed. It doesn't stop when it finds the first true condition. The layers are changing the variable fast enough that every IF is true when the system comes to it. One way to avoid that is the delay.

Another way would be to reverse the order of the triggers, so, for example, the way it is now, when the system comes to #6 and shows that layer, the layer changes the variable to #7 in time for it to be true when the system reaches trigger #7. With the delay, the variable isn't changed to #7 until after the system is past #7. With the triggers reversed, it doesn't matter if the layer changes the variable to #7 before the system gets to the #5 trigger.

Charly Taylor

"It's just that without Jurgen's delay, it opens all the layers too fast for you to see them. When you have a list of triggers associated with one action, the action causes the whole list to be executed."

Thank you, Walt! This is exactly what was happening - I was trying to figure out why it kept going straight to the last layer. I wouldn't call myself a variables expert, but I now have a better understanding of how they function. :)