sounds

  • brentjlaf
  • Student
  • Student
  • User avatar
  • Posts: 67

Post 3+ Months Ago

Ok i have a background sound playing, and i have buttons the when pressed play audio clips i have it so when the buttons are pressed the background sound stops and it plays the new audio clip my question is how to i get the back ground music to start up again after the audio clip has finished?

this is what im using to stop the bg music and play the audio clip

on (release) {
stopAllSounds();
profileSound = new Sound(this);
profileSound.attachSound("diamond");
profileSound.start(0);
}

any help would be appriciated
Thanks
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • lostinbeta
  • Guru
  • Guru
  • User avatar
  • Posts: 1402
  • Loc: Philadelphia, PA

Post 3+ Months Ago

look into the onSoundComplete event handler.

It would go something like....
Code: [ Select ]
profileSound.onSoundComplete = function(){
  //code to start background music.
}
  1. profileSound.onSoundComplete = function(){
  2.   //code to start background music.
  3. }
  • brentjlaf
  • Student
  • Student
  • User avatar
  • Posts: 67

Post 3+ Months Ago

Should this work? I'm getting messed up! Any help would be awesome

on (release) {
stopAllSounds();
profileSound = new Sound(this);
profileSound.attachSound("diamond");
profileSound.start(0);
profileSound.onSoundComplete = function() {
//code to start background music.

bgSound = new Sound(this);
bgSound.attachSound("sound1");
bgSound.start(0, 99);
playB.enabled = false;
slider.slideBar._y = -50;
slider.slideBar.onEnterFrame = function() {
bgSound.setVolume(0-this._y);
};
slider.slideBar.onPress = function() {
startDrag(this, false, this._x, -65, this._x, 0);
};
slider.slideBar.onRelease = slider.slideBar.onReleaseOutside=function () {
stopDrag();
};
stopB.onRelease = function() {
bgSound.stop();
playB.enabled = true;
stopB.enabled = false;
};
playB.onRelease = function() {
bgSound.start(0, 99);
playB.enabled = false;
stopB.enabled = true;
};
stop();
};
}
  • lostinbeta
  • Guru
  • Guru
  • User avatar
  • Posts: 1402
  • Loc: Philadelphia, PA

Post 3+ Months Ago

It's hard to read without the code formatting tags, but it looks to me like you are combining static and dynamic event handlers... which is going to cause you some problems (mainly with targeting)... so there's a chance this may no work depending on your setup.

Post Information

  • Total Posts in this topic: 4 posts
  • Users browsing this forum: No registered users and 13 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.