A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: Sound Button

  1. #1
    Senior Member
    Join Date
    Jul 2001
    Location
    Tinley Park, IL
    Posts
    702
    I wanted to create a sound on/off button but I can't figure out how to make the image change with each condition.

    I originally did it as a button but I can't get the image to change.

    Then I thought to make the button a Checkbox with the on/off images being the play sound/stop sound icons. I then added the action PLAY SOUND to the ON Position and the STOP ALL SOUNDS action to the OFF Position.

    As for changing the image, it works great, but the sounds don't stop. Do I have to create some other action to make the Checkbox process the commands?

    I kind of figured that my problem lies in the fact that a check box is a form item and the variable is not processed until the form is processed?


  2. #2
    Senior Member zoranvedek's Avatar
    Join Date
    Aug 2001
    Location
    Wagoner OK
    Posts
    893
    The simplest way to do this is to make 2 buttons one for sound on, one for sound off. In the actions area for each have either a stop or play command for sound. Place the buttons on top of each other. Then on the button down position for each make it hide itself, and show the other button('sound off' hides 'sound off', and shows 'sound on'). This way if the sound is playing the only option you have is 'sound off' and vice-vera. This will keep you from having the problem of double triggering your sound, and keep it from looping over itself.

    Hope this helps,
    Jason

  3. #3
    Senior Member
    Join Date
    Jul 2001
    Location
    Tinley Park, IL
    Posts
    702
    That's not working.

    When I place the buttons it doesn't give me the Option of Hiding or Showing anything other than blank or mouse.

    Here are the steps I took.

    Added a Picture Button.
    Button down = Play Sound [Choice]
    Tried to add an action of HIDE [other button] but it doesn't give me the option in the drop down.

  4. #4
    Senior Member zoranvedek's Avatar
    Join Date
    Aug 2001
    Location
    Wagoner OK
    Posts
    893
    In the elements list, next to your button will be a button, if you hover over it, it will ay something like "element has properties" click this down, and then you will be able to hide/show your buttons.

    -Jason

  5. #5
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244

    easy

    Originally posted by dniezby
    I wanted to create a sound on/off button but I can't figure out how to make the image change with each condition.

    I originally did it as a button but I can't get the image to change.

    Then I thought to make the button a Checkbox with the on/off images being the play sound/stop sound icons. I then added the action PLAY SOUND to the ON Position and the STOP ALL SOUNDS action to the OFF Position.

    As for changing the image, it works great, but the sounds don't stop. Do I have to create some other action to make the Checkbox process the commands?

    I kind of figured that my problem lies in the fact that a check box is a form item and the variable is not processed until the form is processed?

    Ah I've done this many times.

    step 1

    Make a Chooser element and assign two views one for on and one for off.

    Step 2

    Make a picture button but "PUT NOTHING IN IT" click on the HOTSPOT tab and draw a box paint element that will cover the chooser. This makes an invisible button. Now put this button on top of your chooser element.


    Step 3

    In the button up action add the action select view and pick the chooser from the pull down. use next view.


    I set a varible to tell me whether the sounds should play or not and use it to turn the sound off and on as well.

    I have an example interface that I had not put up because it was still too big for my tastes, but here:
    http://deadyeti.com/blanius/barcodes.html
    http://deadyeti.com/blanius/barcodes.movie source.

    It uses this technique.

  6. #6
    Senior Member zoranvedek's Avatar
    Join Date
    Aug 2001
    Location
    Wagoner OK
    Posts
    893
    Hey Bret,

    Nice interface...........

    -Jason

  7. #7
    Senior Member
    Join Date
    Jul 2001
    Location
    Tinley Park, IL
    Posts
    702
    Bret,
    That is a pretty cool interface.

    Thanks for the input.

    I will try both of these techniques. See which one works best.

  8. #8
    Senior Member
    Join Date
    Jul 2001
    Location
    Tinley Park, IL
    Posts
    702
    I got it working.
    The two button method was a lot quicker to do.
    Click to see in action

    Thanks guys.

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