hi leuts,
ich versuche zwei sounds auszuwechseln,. der currentsound soll ausgefaded werden, der andere eingeblendet werden.
klappt nicht ganz, denn die volume laueft ins minus.. wo ist der fehler?
ActionScript:
//hier wird der erste zugewiesen
_global.currentSound=this.soundMc0;
startSound(_global.currentSound);
//so soll gewechslet werden
//setSound(_global.currentSound,this.soundMc5);
_global.startSound=function(sound)
{
//damits nicht mehrfahc aufegrufen wird
if(!this.playing)
{
sound.s.setVolume(0);
sound.s.start(0,1);
//ueberschreiben
_global.currentSound=sound;
sound.s.onSoundComplete=function()
{
sound.s.start();
}
sound.onEnterFrame=function()
{
trace("startSound : " + this + " " +this.s.vol);
this.s.vol=this.s.getVolume();
this.s.vol++;
this.s.setVolume(this.s.vol);
if(this.s.vol==70)
delete this.onEnterFrame;
}
this.playing=1;
}
}
_global.stopSound=function(sound)
{
sound.s.vol=sound.s.getVolume();
sound.s.setVolume(sound.s.vol);
sound.onEnterFrame=function()
{
trace("stopSound :" + this + " " +this.s.vol);
this.s.vol--;
this.s.setVolume(this.s.vol);
if(this.s.vol==0)
{
this.s.stop();
delete this.onEnterFrame;
}
}
this.playing=0;
}
_global.setSound=function(currentSound,nextSound)
{
this.currentSound = currentSound;
this.nextSound = nextSound;
trace("nextSound :" +this.nextSound)
trace("currentSound :" +this.currentSound)
_global.nextSound=this.nextSound;
stopSound(this.currentSound);
startSound(this.nextSound);
}