A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: attachSound - playing 2 tracks at the same time

  1. #1
    Junior Member
    Join Date
    May 2007
    Posts
    8

    attachSound - playing 2 tracks at the same time

    Hi guys,

    I was wondring is it possible to play 2 sounds at the same time using the attachSound method? Not able to get it to work and cant find any help anywhere on the net.

    The code im using at the minute is:

    --------------------------------------
    mySound=new Sound();
    mySound.attachSound("song1");
    mySound.start();
    mySoundVolume = 50;
    mySound.setVolume(mySoundVolume);
    --------------------------------------

    Thanks!

  2. #2
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    tie the sounds to created movieclip timelines
    this gives you individual control over each sound -
    Code:
    this.createEmptyMovieClip("aClip",1000);
    aSound=new Sound(aClip);
    aSound.attachSound("song1");
    aSound.start();
    aSoundVolume = 50;
    aSound.setVolume(aSoundVolume);
    
    this.createEmptyMovieClip("bClip",1001);
    bSound=new Sound(bClip);
    bSound.attachSound("song2");
    bSound.start();
    bSoundVolume = 50;
    bSound.setVolume(bSoundVolume);
    
    btn.onRelease = function(){
    stopper=(pressed=!pressed) ? 
    bSound.stop() : 
    bSound.start();
    }
    hth

  3. #3
    Junior Member
    Join Date
    May 2007
    Posts
    8
    Quote Originally Posted by a_modified_dog
    tie the sounds to created movieclip timelines
    this gives you individual control over each sound -
    Code:
    this.createEmptyMovieClip("aClip",1000);
    aSound=new Sound(aClip);
    aSound.attachSound("song1");
    aSound.start();
    aSoundVolume = 50;
    aSound.setVolume(aSoundVolume);
    
    this.createEmptyMovieClip("bClip",1001);
    bSound=new Sound(bClip);
    bSound.attachSound("song2");
    bSound.start();
    bSoundVolume = 50;
    bSound.setVolume(bSoundVolume);
    
    btn.onRelease = function(){
    stopper=(pressed=!pressed) ? 
    bSound.stop() : 
    bSound.start();
    }
    hth

    Super, thanks alot, gona give this a try now to see how it goes.

    Many thanks!


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