• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Shared actions with conditionals

New Here ,
Oct 15, 2021 Oct 15, 2021

Copy link to clipboard

Copied

Hello everyone!

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

If _var_audio==1;

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

 

Else

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?

 

Any suggestions?

 

Thanks in advance.

 

 

 

 

Views

604

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Oct 15, 2021 Oct 15, 2021

Did you use this action as shared action or as advanced action? 

For a shared action I would use these parameters:

  1. The button, which needs to be different on each slide since it needs to play a different audio clip
  2. The audio clip

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 contain

...

Votes

Translate

Translate
Community Expert ,
Oct 15, 2021 Oct 15, 2021

Copy link to clipboard

Copied

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 15, 2021 Oct 15, 2021

Copy link to clipboard

Copied

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? 

 

Sincerely,

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 15, 2021 Oct 15, 2021

Copy link to clipboard

Copied

Did you use this action as shared action or as advanced action? 

For a shared action I would use these parameters:

  1. The button, which needs to be different on each slide since it needs to play a different audio clip
  2. The audio clip

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 15, 2021 Oct 15, 2021

Copy link to clipboard

Copied

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.

 

Thanks again.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 15, 2021 Oct 15, 2021

Copy link to clipboard

Copied

LATEST

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:

http://blog.lilybiri.com/tip-4-decisions-advanced-slash-shared-actions

And:

http://blog.lilybiri.com/tip-5-parameters-shared-actions

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Help resources