I have this project with 10 slides and I want to use a Shared Action. Each slide is a cutomized question where the user plays an audio twice. I have managed to create the advanced action for the first slide, as follows:
_var_audio= with default value of 2;
Then, the condition
play = selected audio
Decrement _var_audio by 1;
disable = selected button (there is one play button on each slide; each with a different name).
hide = selected button
Play = selected audio
Decrement _var_audio by 1
1. On the second slide, I tried to reset the variable _var_audio on an enter slide by incrementing it to 2 (didn't work).
2. Should I create a variable for each audio on each slide?
Thanks in advance.
There is no reason whatsoever why you cannot reuse that variable by resetting it with the On Enter action of each slide.
I use shared actions all the time because for each advanced action I reflect whether a shared action wouldn't be possible. Can you give some more details about the error you experienced? What is your debug workflow?
Thanks fro replying Lilybiri:
When I preview the entire project (10 slides), the first slide works fine. After the second click on the play button, it disables and hides the button . When I click go to next slide, it also works fine. However, from slide 2 on, the play button on each slide keeps playing the audio more than twice and it doesn't disable or hide it. No error message is generated on the preview. Is there a specific way to debug the project while previewing it?
Did you use this action as shared action or as advanced action?
For a shared action I would use these parameters:
The variable v_audio doesn't need to be a parameter, but needs to be reset On Enter for each slide to the default value of 2.
Debugging: on the first slide insert the variable v_audio (sorry for not using your longer name) in a text container. Time that text container for the rest of the project, always on top. Now you can check if the variables acts as expected.
Thanks so much Lilybiri.
It worked. On enterSlide I had increment instead of assign.
When change it to assign _var_audio to 2, it worked.
I should have asked immediately about the On Enter action. The debugging suggestion did the trick, right?
Your conditional action with the THEN/ELSE approach will only work in that situation when the value of the variable is 2 when entering a new slide. Now the ELSE part will also occur when the decrement leads to -1, -2. That is the reason I often prefer multiple decisions. Have a look at: