dcsimg
A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Play sound after having stopped all

  1. #1
    Junior Member
    Join Date
    May 2003
    Posts
    27

    Play sound after having stopped all

    Hi all,

    I have a problem:

    After I have clicked "stop music" (StopAllSounds), I would like the music to be able to start again (even though from the beginning of the song). However, I would like this to be possible while the movies are running in the timeframe. How do I do this? Can I give the song a specific name and then allocate play and stop commands to it? And which commands would that be?

    Thanks in advance for any indication on this.

  2. #2
    FK's Geezer Mod Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Location
    Out In The Pasture
    Posts
    20,490
    Depends on how you played the sound in the first place. If it's loadSound, just reload it, from anywhere in the movie. If it's attachSound, just attach it again, from anywhere in the movie.

  3. #3
    Junior Member
    Join Date
    May 2003
    Posts
    27
    I have two scenes with two different songs running.
    In both cases I have imported the sound to the library (I wasn't aware that there were other methods than that...)

    In the first scene it's a stream Sound and in the second, it's an event sound (goes on). Is that what you meant?

  4. #4
    FK's Geezer Mod Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Location
    Out In The Pasture
    Posts
    20,490
    Yes, just wondered how you did it, there are so many ways. You can stream in a song, direct from a server with loadSound. Only good for big long running sounds tho, cause it won't work as a loop easily. You can use this in a frame or on a button:

    mySound = new Sound();
    mySound.loadSound("music1.mp3", true);

    Or, you can use attachSound in a frame or a button after giving the library sound a Linkage Identifier:

    mySound = new Sound();
    mySound.attachSound("snd1");
    mySound.start(0,1);

    This will loop up to 200,000 times by setting the loops where the number 1 is above.

    Stopping them is easy by just adding the line:

    mySound.stop();

    Here;s a good resource FAQ that covers sounds and how to use them in Flash:

    http://www.flashkit.com/board/showth...hreadid=299918

  5. #5
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Or this one...

    http://www.kennybellew.com/

    BTW, ALLWAYS add this to your soundObjects' definitions, it will keep you out of further trouble...

    mySound = new Sound(this);
    mySound.attachSound("snd1");
    mySound.start(0,1);

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