A Flash Developer Resource Site

Results 1 to 10 of 10

Thread: on/off using the same btn

  1. #1
    Junior Member
    Join Date
    Apr 2000
    Posts
    21

    Question

    Hi, I have a movie with a button to turn the sound off. How do I enable this button to turn the sound back on? The control panel only allows me to use "On Press" once and I don't see a "start all sounds". Also, if it is possible to turn the sound back on can I swap the button image out when toggled from the on/off.
    Thanks Ahead

    I wasn't sure if this should be in the sound or scripting board. Sorry if this is wrong.

  2. #2
    Junior Member
    Join Date
    May 2000
    Posts
    15

    Post

    There would be several ways to do this, here's one of them

    Create a seperate movie with 2 frames, 1 with your sound file, one with the action stop all sounds. Have your button target the "sound" movie with the action play.

    Hope this helps.

  3. #3
    Junior Member
    Join Date
    Apr 2000
    Posts
    21

    Question

    Hi Generro, thanks for the reply. I created a new scene "sound" with two frames, one with the sound and the other with a stop all sounds action. I then went back to the original scene and gave the button these commands: on press, begin target "sound", play. I think I was a little confused on this part, could you explain further, please.

    Thanks, Dan P.

  4. #4
    Junior Member
    Join Date
    May 2000
    Posts
    8

    Post

    http://www.virtualfx.net/tutorials/html/musiconoff3.htm


    is a great tute for sound on off
    hope it helps

  5. #5
    Junior Member
    Join Date
    Apr 2000
    Posts
    21

    Question

    Tutorial not found?

  6. #6
    Junior Member
    Join Date
    May 2000
    Posts
    15

    Post

    No problem Dan, here we go )

    First, create a new "movie", a new symbol that has the behavior of a movie. In this new "movie" place your sound in frame 1, loop it as many times as you feel are neccesary. In frame 2 set the properties with an action to stop all sounds. Both frames must also have the action "stop".

    Ok, now we have a new "movie" in our library that contains our sound. Back on the main stage place this "sound" movie wherever you want your sound to start. I would suggest you place it on it's own layer called "sound" to make it easier to keep track of.

    Once you drag the sound movie onto the stage a small icon will appear on the stage to represent the sound movie, right click on it and bring up the properties, we need to give the movie an "instance" name. Name the instance "sound", this will allow you to "tell target" "sound" to "play".

    So...back to your button )

    You need to set you button to "tell target". Your "target" is the "instance" "sound". You want to tell this target to "play". This will cause the "sound movie" to advance to frame 2 which has the actions stop all sounds, stop. Clicking the button again will tell the target to play again, causing the sound movie to go to frame 1, play the sound and stop. Each time you click the button you will move the sound movie between frames 1 and 2 causing the sound to start and stop )

    The sound should not be placed anywhere else in your movie, only in the "sound movie" which you've placed on the stage at the proper time. This is placing movies within movies and utilizing the tell target command to control the element you want.

    Remember the tell target relies on an instance name, it doesn't target movies, it targets instances.

    I hope this helps )

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

    Wink

    Now if I can figure out these damn happy face things I'LL be ok.

  8. #8
    Junior Member
    Join Date
    May 2000
    Posts
    15

    Post

    This may help with the tell target:

    On(Release,Release Outside)
    Begin Tell Target ("sound")
    Play
    End Tell Target
    End On

  9. #9
    Junior Member
    Join Date
    Apr 2000
    Posts
    21

    Question

    Thanks for the help, unfortunately each time that sound file is stopped and started it goes back to the beginning of the loop. I am looking for a file that will start the sound back up at the point were the main movie has reached. I am not sure if this is possible, but it keeps the movie in rhythm and fades the loop at the end of the movie, even if the viewer decides to stop and start the sound. Here is the file for reference, I can only figure out how to start it from the beginning, http://clients.brainbug.com/outrider...on2/flash.html

    Thanks

  10. #10
    Junior Member
    Join Date
    May 2000
    Posts
    15

    Post

    So Dan you want to actually mute the sound but have it still playing...hmmmm.

    Got me on that one, I'm not aware of anyway to do that.

    The loop you are suing seems to be very short, I toggled it on and off several times and it seemed to work ok, to me at least. If the loop was longer I could see why you would want to ensure the viewer came "back" at the right place in the sound loop but I found when restarting the sound it was impossible to tell if it was in sync with where I had left the sound.

    Just my 2 cents, hope it all works out for you.

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