A Flash Developer Resource Site

+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Junior Member
    Join Date
    May 2007
    Posts
    25

    stop multiple sound objects at once

    hi all,long time no see,jus wanna thx those who've helped mi in one way or another..even though some codes din work but ur helpfulness i appreciate.
    =)

    anyways, here's another help needed!

    how to stop multiple sound objects at once? im using sound objects btw
    n i dun wanna use arrays. is there anyway where i can stop them on clicking one button and all sounds objects stops? but i dun wanna use stopAllSounds() cus it'll stop my bg sound too(which i wans the bg sound to continue)

  2. #2
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    you need to create your sound objects with a numerical sequence
    you can then loop through the numbers to stop the sounds
    here i've used s1 - s4 as the sound object names
    Code:
    this.createEmptyMovieClip("background_sound",100);
    bg = new Sound(background_sound);
    bg.attachSound("songa");
    bg.start();
    
    this.createEmptyMovieClip("sb1",101);
    s1 = new Sound(sb1);
    s1.attachSound("songb");
    s1.start();
    
    this.createEmptyMovieClip("sb2",102);
    s2 = new Sound(sb2);
    s2.attachSound("songc");
    s2.start();
    
    this.createEmptyMovieClip("sb3",103);
    s3 = new Sound(sb3);
    s3.attachSound("songd");
    s3.start();
    
    this.createEmptyMovieClip("sb4",104);
    s4 = new Sound(sb4);
    s4.attachSound("songe");
    s4.start();
    
    stop_btn.onRelease = function(){
    for (var n=1; n!=5; n++){
    _root["s"+n].stop();
    }
    };
    ps .. it'll help all if you post in Plain English
    i have this theory that if you can't write properly,
    you probably can't read that well either and i tend
    to avoid posting answers as i like to avoid those -

    it dun wk 4 me, cn u fx plz kind of replies
    Last edited by a_modified_dog; 05-28-2007 at 09:04 AM.

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