|
Тема |
Towa shte pomogne na Sertys :-) |
|
Автор |
moonjogger (Хе-хе!) |
|
Публикувано | 09.08.01 22:10 |
|
|
Mislq che tova shte pomogne mnogo za sinhronizaciq i n.t
Ako ima neshto neqsno - shte se radvam da obqsnq - ako moga
pause() - Ako ima zvuk shte go spre, ako ne - go puska
isBusy() - Vrashta "viarno" ako ima zvuk, ako ne - "nevqrno"
timeElapsed() - Vrashta vremeto otkakto e pusnat zvuka (v sekundi)
timeRemaining() - vrashta vremeto ostavashto do svarshvaneto na svuka(v sekundi)
//---------------------------------------------------------------------------------------------
// Sound2 prototype object
//---------------------------------------------------------------------------------------------
//constructor
function Sound2(mc){
this.sound = new Sound(mc);
this.secs = 0;
this.startTimer = null;
this.pauseTimer = null;
this.timer = 0;
this.paused = false;
}
//stop
function Sound2_stop(id){
this.startTimer = null;
this.sound.stop(id);
}
//start
function Sound2_start(offset, loops){
this.offset = offset;
this.startTimer = getTimer() - (offset*1000);
this.sound.start(offset, loops);
this.duration = this.secs*(loops+1)*1000;
trace(this.duration);
this.loops = loops;
}
//pause
function Sound2_pause(){
var currTime = getTimer();
if (!this.paused){
this.timer = currTime - this.startTimer;
this.pauseTimer = currTime;
this.paused = true;
this.sound.stop(this.soundID);
}else{
this.paused = false;
var tempStart = this.startTimer + (currTime - this.pauseTimer);
this.start(this.timer/1000);
this.startTimer = tempStart;
}
}
//attachSound
function Sound2_attachSound(soundID, secs){
this.soundId = soundID
this.secs = secs;
this.sound.attachSound(soundID);
}
//isBusy
function Sound2_isBusy(){
if (this.startTimer != null){
if (getTimer() - this.startTimer < this.duration){
return (true);
}else{
return (false);
}
}else{
return (false);
}
}
//timeElapsed
function Sound2_timeElapsed(){
var currTime = getTimer();
if (this.startTimer != null && (currTime - this.startTimer < this.duration)){
return ((currTime - this.startTimer)/1000);
}else{
return (-1)
}
}
//timeRemaining
function Sound2_timeRemaining(){
var currTime = getTimer();
if (this.startTimer != null && (currTime - this.startTimer < this.duration)){
return ((this.duration - (currTime - this.startTimer))/1000);
}else{
return (-1)
}
}
//A sega da postroim Obekta :-)
Sound2.prototype.stop = Sound2_stop;
Sound2.prototype.start = Sound2_start;
Sound2.prototype.pause = Sound2_pause;
Sound2.prototype.attachSound = Sound2_attachSound;
Sound2.prototype.isBusy = Sound2_isBusy;
Sound2.prototype.timeElapsed = Sound2_timeElapsed;
Sound2.prototype.timeRemaining = Sound2_timeRemaining;
Sound2.prototype.getPan = function(){ return (this.sound.getPan())};
Sound2.prototype.getTransform = function(){ return
(this.sound.getTransform())};
Sound2.prototype.getVolume = function(){ return (this.sound.getVolume())};
Sound2.prototype.setPan = function(pan){ return (this.sound.setPan(pan))};
Sound2.prototype.setTransform = function(obj){ return
(this.sound.setTransform(obj))};
Sound2.prototype.setVolume = function(volume){ return
(this.sound.setVolume(volume))};
//---------------------------------------------------------------------------------------------
|Не се изказвай за неща, които не разбираш|
|
| |
|
|
|