Skip to main content
Known Participant
November 14, 2022
Question

Lire de sons à la suite avec playSound

  • November 14, 2022
  • 1 reply
  • 2288 views

Bonjour à tous !

 

comment peux-ton lire 2 sons à la suite avec le code

playSound("FirstSound");
playSound("SecondSound");

 

Merci pour votre aide ..

 

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
November 14, 2022

is this an as3 or canvas/html5 project?

Known Participant
November 14, 2022

canvas project ! sorry

kglad
Community Expert
Community Expert
November 14, 2022

create a button (or something) that will start your sound playing:

 

// this.b is a movieclip

createjs.Sound.on("fileload", loadF.bind(this));
createjs.Sound.registerSound("./z_sounds/RS.mp3", "s1_id", 4);  // assign paths to your sounds
createjs.Sound.registerSound("./z_sounds/Buzzer.mp3", "s2_id", 4);
this.b.alpha = .3;

 

function loadF(){
this.b.alpha = 1;
this.b.addEventListener("click",f.bind(this));
}
function f(){
createjs.Sound.play("s2_id");
createjs.Sound.play("s1_id");
}