Announcement

Collapse
No announcement yet.

Toggle image on click

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Toggle image on click

    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.

    here is the code:

    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

  • #2
    Audio.Play() does not return a value, so you can't use this action in a comparison. You can create a custom variable, for example bIsAudioPlaying, and set it appropriately to true and false, and use it in the comparison.
    Ulrich

    Comment

    Working...
    X
    😀
    🥰
    🤢
    😎
    😡
    👍
    👎