A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: using "If" statement to start/stop button sounds

  1. #1
    Junior Member
    Join Date
    May 2000
    Posts
    7

    Arrow

    I'm designing an interactive CD-ROM for my company. I have added buttons that play a sound (sample sounds of our products) on the "down" state. Some of the sounds are quite long. I would like the sound to stop when the same button, is clicked on.

    I think the thing I want to do if the button with the sound attached is clicked is write an "if" statement that would go like this:

    If "button sound" is playing
    stop all sounds
    Else
    play "button sound"
    End If


    I just don't know how to write it. I'm reading up on the subject but figured I would probably get a quicker response if i posted it on the web.

    Thanx in advance for all future replies

  2. #2
    Junior Member
    Join Date
    May 2000
    Posts
    16
    What I have understood is that on one click u want to start sound on the other click u want to stop it. For this in button properties->Actions write following:

    On (Press)
    If (snd = 0)
    Set Variable: "snd" = 1
    Else
    Stop All Sounds
    Set Variable: "snd" = 0
    End If
    End On

    Or in case u want to start sound on mouse down and stop it at mouse up write the following instead of the above mentioned in Button Properties->Action

    On (Release)
    Stop All Sounds
    End On

    But certainly before this u have to drag sound in Cutton->Edit->Down keyframe

    I hope it solves your problem. In case it doesn't do lemme know.

    Arshad

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center