1

I'm trying to toggle an image when a user clicks on the image. It is meant to change the image and mute the audio that is playing in background and vice versa. I'm using lua in a program called Indigo Autoplay media studio 8.

here is the code:

if (Audio.Play(CHANNEL_BACKGROUND) == true) then
    Audio.Pause(CHANNEL_BACKGROUND);
    Image.Load("playpause", "AutoPlay\\Images\\gg57570759.png");
else
    Image.Load("playpause", "AutoPlay\\Images\\gg57570759 on.png");
    Audio.Play(CHANNEL_BACKGROUND);
end
hjpotter92
  • 78,589
  • 36
  • 144
  • 183
acidburn
  • 11
  • 2

1 Answers1

0

First you need to add the following script to On Click event of the image:

Audio.TogglePlay(CHANNEL_BACKGROUND);

Then open the page properties and add the following script to On Audio event of the page:

if (e_State == "Pause") then
    Image.Load("playpause", "AutoPlay\\Images\\gg57570759.png");
else
    Image.Load("playpause", "AutoPlay\\Images\\gg57570759 on.png");
end
Sajad Rastegar
  • 3,014
  • 3
  • 25
  • 36