Forum Discussion

DeirdreSherman's avatar
DeirdreSherman
Community Member
7 years ago

Variable doing the opposite of what it says

Hi,

I have the following: Slide with button to play and stop music when user clicks button. Button has two states, Normal = "Turn Music Off" and Selected = "Turn Music On" with the following variables:

  • 1st variable: "Stop Media when user clicks button 1 if button is in state Normal"
  • 2nd variable: "Play Media when user clicks Button 1 if button is in state Selected"

I want the music to play by default. If the user clicks "Turn Music Off" the music should stop. If user clicks "Turn music on" the music should start. Instead what happens is the music does not play by default, and when user clicks initial state button "Turn Music off" the music plays and when user clicks "Turn Music On" the music stops. 

You would think that reversing the logic would work, but it doesn't - it just becomes more complicated.

Can anyone tell me what I'm doing wrong? 

5 Replies

  • NedWhiteley's avatar
    NedWhiteley
    Community Member

    Hi Deirdre,

    Are you able to post a copy of your Storyline file here as that would be a big help in finding a solution to your problem?

    Thanks.

  • MichaelHinze's avatar
    MichaelHinze
    Community Member

    Have a look at the attached which (I think) is a simpler solution. I toggle a True/False variable by clicking the button and based on the variable value, I play/stop the sound. 

    • DeirdreSherman's avatar
      DeirdreSherman
      Community Member

      Thank you.

      Unfortunately I can't upload due to security. I could send the file to you directly.  I looked at your example, but it seemed complicated. I am still new to Storyline. I guess i need to take a course. 

  • I never use a variable, but I always use equal top elected and not equal to selected rather than normal as most built instates validate as normal