Basic Variable question


I have read a lot about variables. However, still don't know when to use them. Can anyone explain in-context of the below example I have created.

What if want to again play the sound on a particular object as you can see in my example  I can only play the sound once and not again. Do variable comes in handy in this situation?? I get confuse between states, layers & variable :(

Story file attached.




2 Replies
Phil Mayor

For the example you show it is probably better to put the audio on a layer and then add a couple of triggers show the layer, make sure the layer hides itself at the end. You could add another trigger first to hide the layer so this way each time they press the button it will play the audio from the start.

You could just add triggers to stop the audio before your current trigger, but this will not prevent the audio from overlaying the other audio, layers is a more elegant design.

You don't need variables here. Variables are a way to store and pass information between slides and also a way to pass information out in javascript. You can also use variables to track progress on slides and to do calculations.