home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 112
/
jogo-disk-112.iso
/
Games
/
barrels_of_monkey.swf
/
scripts
/
__Packages
/
SoundManager.as
< prev
Wrap
Text File
|
2010-07-14
|
2KB
|
77 lines
class SoundManager extends Snd
{
var muted = false;
var curVol = 100;
function SoundManager(hld_mc)
{
super();
this.sounds = new Object();
this.mc_holder = !hld_mc ? _root : hld_mc;
}
function playAndRemove(snd_id, offset, loops)
{
offset = !isNaN(offset) ? offset : 0;
loops = !isNaN(loops) ? loops : 0;
var _loc2_ = this.newSound(snd_id);
_loc2_.start(offset,loops);
_loc2_.onSoundComplete = _loc2_.remove;
return _loc2_;
}
function clearAllSounds()
{
for(var _loc2_ in this.sounds)
{
this.sounds[_loc2_].remove();
}
}
function newSound()
{
var _loc5_ = this.mc_holder.getNextHighestDepth();
var _loc6_ = this.mc_holder.createEmptyMovieClip("sh_mc" + _loc5_,_loc5_);
var _loc4_ = new Snd(_loc6_,this);
var _loc3_ = 0;
while(_loc3_ < arguments.length)
{
if(arguments[_loc3_] != undefined)
{
_loc4_.attachSound(arguments[_loc3_]);
}
_loc3_ = _loc3_ + 1;
}
this.sounds[_loc5_] = _loc4_;
return _loc4_;
}
function deleteSound(snd)
{
snd.remove();
}
function setVolume(vol)
{
if(this.muted)
{
this.curVol = vol;
}
else
{
super.setVolume(vol);
}
}
function get mute()
{
return this.muted;
}
function set mute(b)
{
this.muted = b;
if(b)
{
this.curVol = this.getVolume();
super.setVolume(0);
}
else
{
super.setVolume(this.curVol);
}
}
}