-
Notifications
You must be signed in to change notification settings - Fork 0
audioPlayer Objects
Arshia edited this page Dec 11, 2019
·
2 revisions
Way To Use This Object Type :
var audio = new audioPlayer(id);
audio.[function]();
id : Id Of The Object That You Wanted To Add Audio Player To It. For Example Your Main Character .
All Of Functions That Available Now Are Here :
addPlayer( event [ The Event For Example Mouse Click ] , func [ The Function That Contains Codes ( Audio And ...) ] )
Example :
// playAudio Is A Function Of Jsha .
function func1(event){
playAudio("./myaudio.mp3");
}
function func2(event){
if(event.key == "a"){
playAudio("./audio1.mp3");
}
else{
playAudio("./audio2.mp3");
}
}
var audio = new audioPlayer("player");
audio.addPlayer("click",func1);
audio.addPlayer("keypress",func2);
Something That Maybe Useful For You :
- You Can Access To The Object Like That :
var audio = new audioPlayer("player");
audio.addPlayer("click",func1);
// print Is A Jsha Function .
print(audio.object);