A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Sound control

  1. #1
    Junior Member
    Join Date
    Jan 2001
    Posts
    11

    Sound control

    I have managed to make a player using simple actionscript to fade between two songs. (still bit of a newbe though) ;-)
    It's probably not the best way to do it, but at least it works...
    but there's still one thing I have problems with.
    I can't make the songs start playing right before they fade in.
    If you listen to the example the songs keep playing even when they aren't used. How do you prevent that?
    Similarly if I were to use the fade system in a animation, how would I script it so the songs would start playing only when they were needed, and not from the start?
    Here's what I have so far:
    http://www.stratyon.com/flash/shakira1.swf
    http://www.stratyon.com/flash/shakira1.fla
    (The sounds aren't included in the .fla or it would be 9Mb... Just add any
    two sounds as event to the first frame of the sound1 and sound2 movie clips)

    ~Stratyon

  2. #2
    Senior Member cHIs-wK's Avatar
    Join Date
    Sep 2002
    Location
    Scotland
    Posts
    220
    i cant hear the sounds(no speakers on college pc)
    BUt i think your problem could be you just need to use the StopAllSounds action, located in basic actions. Or is it basic actions
    If not try actions, shud be basic actions, just put that action on the frame where you want the music to stop.


    No snazzy little quote to go here.

  3. #3
    Junior Member
    Join Date
    Jan 2001
    Posts
    11
    That doesn't work... It stops all the sounds. not just one of them.
    I also tried using the .stop() and .start() actions but it didn't seem to work.
    Well at least the .start() action didn't work. I ended up with no sound at all when using .stop(). The .start() action couldn't start the sounds again.

  4. #4
    Senior Member cHIs-wK's Avatar
    Join Date
    Sep 2002
    Location
    Scotland
    Posts
    220
    oh i see, you just want one sound to stop.
    Right click on the frame where you want it to stop, drop the menu down to panels then sound, on the small sound drop down menu, choose the sound you want to stop.
    Then drop the Sync menu down to stop.


    No snazzy little quote to go here.

  5. #5
    Junior Member
    Join Date
    Jan 2001
    Posts
    11

    Well...

    Right... and how do I start it again?

    By the way, I don't think you understand how the movie is set up.
    Look in the fla... there's a Movie clip called "Control". it contains the actionscript for the fade effect, but the sounds themselves are located in other movie clips. (Sound1 and Sound2)
    Using a .stop() method and using the stop sync both works at turning off one of the sounds, but they are supposed to start again the next time the button is clicked.

    in the fla it would be like this:
    Frame 1: Sound1 starts playing and fades in
    Frame 12: is the end of the fade in and the movie clip stops.
    When the "switch" button is clicked the movie clips start playing again and on--
    Frame 13: Sound2 starts playing and the crossfade begins
    Frame 23: The crossfade is complete and Sound 1 is stopped
    Frame 24: The crossfade begins again and Sound1 starts playing
    Frame 34: the crossfade is again completed and sound2 stops.
    Frame 35: The movie jumps back to frame 13 and the crossfader begins over again.

    This is how it should be. As it is now everything works fine except the songs don't start and stop but just keeps looping and the volume is turned up and down.
    It would be possible to just reset the song so it starts playing from the start again instead of stopping it completely, but I suspect Flash uses resources to playback sounds even if the volume is at zero.

    Take a look in the fla. and put in some songs and try it out for yourselves.

  6. #6
    Junior Member
    Join Date
    Jan 2001
    Posts
    11
    Bumpety bump...

    Still wondering about this thing.

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