Java, Layers and States

Hey there everyone. This will be my first post and I just have a quick question. I am new to Java and have mostly been using states and layers for the interactions in my projects. I was wondering if there is a way to change the state of an object with an Execute JavaScript trigger? I have several layers that the user will navigate between and would like them to be able to reset the state of all objects on a layer without affecting the entire slide. (also this needs to happen on a trigger, so resetting to initial state upon revisiting the layer wont do.) I tried searching other posts but could not seem to find what I was looking for.

Thanks in advance for any help.

4 Replies
Michael Hinze

You can't directly change the state of an object with JS. You could use a Javascript to change the value of a Storyline variable and then, based on the that changed value, change states. Without seeing your file I can only guess, but it sounds like you could simply use triggers on a layer to 'reset' objects on that layer. I don't think JS would be needed here.

Randall Sauchuck

Hi Christian, Michael is right, you can't directly set states for objects on other slide layers. You can set states based on variable values however you need some event to trigger the change (like "when timeline starts" or "when variable changes"). I tried a quick sample to see if I could make it work. unfortunately the event "when variable changes" doesn't seem to affect objects on other layers either. You said you didn't want to use "reset initial state" on the layers but I think you will have to. I made an example that has two variables that control the states of two buttons on the "mid" layer. Please take a look and see if this helps.

Christian Cuneo

Thank you all for the replies, and my mistake only saying Java. I will just have to use variables and triggers it looks like. I am trying to reset quite a few objects and there are already tons of triggers on each lever so I was just trying to use JS to reset everything with one trigger.