Using Variables for Object Show Trigger

rcarlson8673 Community Member Posts: 37

I am new to Lectora, and I am not all that great with variables. I thought that I had understood variable management and how to trigger an object to show, but it did not result in success after a lot of troubleshooting.

Let's say you have a page that has an inherited (from title) hidden object. Also on this page, you have three audio clips. One audio clip that plays on launch of the page and two others that are triggered by clicking two buttons.

If I wanted to only show the hidden object only after all three audio clips done playing play, how would I go about this?

What I attempted did not work. What I did try was:

I created three variables to correspond with the three audio clips.
Variable Audio 1 = Value of 0
Variable Audio 2 = Value of 0
Variable Audio 3 = Value of 0

Object inherited to page that I want to display after three audio clips are done playing = initially hidden
Audio Clip 1=
Action: On Done Playing then Modify Variable Audio 1 - equal to = 1

Audio Clip 2=
Action: On Done Playing then Modify Variable Audio 2 - equal to = 1

Audio Clip 3=
Action: On Done Playing then Modify Variable Audio 3 -  equal to = 1

Finally, action I set to the is set to make the object display on the page only after all three variables are set to 1... so...

Page with all audio and inherited object on it -
On Show - Do Nothing, if conditions set to Variable Audio 1 Equal to 1, Variable Audio 2 Equal to 1, and Variable Audio 3 Equal to then show object that is initially hidden.

I don't know if I'm totally just not understanding the fundamentals of how variables work, but I thought this would do the trick... I apologize if I'm just a babbling ****.

Any thoughts of an easier solution or how I may have tripped up??




  • timk
    timk Community Member Posts: 1,237 ✭ Legend ✭
    I don't think you can have an action doing nothing, it should either throw an error or it won't be added to the page at all. An On: Show action on page level is run once when the page is loaded, so it cannot be used to do something on the page later on. It can be used to show the object when a user returns to the page.

    Your conditions and use of the variables should be correct, you just need another trigger. Add a second action to each of your audios

    On: Done Playing
    Action: Show
    Target: Your object

    ... and use the same conditions (if "audio1 = 1 AND ...)
  • cainam
    cainam Community Member Posts: 365 ♦ Idol ♦
    I agree with Tim's solution as the preferred.  If you wanted to keep everything as you have it, then instead of having the action on the page: on 'show', 'show' object, (with conditions) you would need to change to:

    on 'timed interval', 'show' object, (with conditions).
    - Adam Cain
  • rcarlson8673
    rcarlson8673 Community Member Posts: 37
    Tim's solution worked perfect. Thanks for explaining to me why mine wasn't working... Appreciate both of your help.