home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Acao / midnightstrike1.swf / scripts / __Packages / com / neodelight / std / XSoundChannel.as < prev    next >
Encoding:
Text File  |  2007-04-02  |  1.6 KB  |  64 lines

  1. class com.neodelight.std.XSoundChannel extends Sound
  2. {
  3.    var id;
  4.    var playing;
  5.    var locked;
  6.    var groups;
  7.    var mc;
  8.    var channel;
  9.    var volume;
  10.    var group;
  11.    var fading;
  12.    function XSoundChannel(id, mc, groups)
  13.    {
  14.       super(mc);
  15.       this.id = id;
  16.       this.playing = false;
  17.       this.locked = false;
  18.       this.groups = groups;
  19.       this.mc = mc;
  20.       this.mc.channel = this;
  21.       this.mc.onEnterFrame = function()
  22.       {
  23.          if(!this.channel.fading)
  24.          {
  25.             return;
  26.          }
  27.          var _loc2_ = this.channel.getVolume() + this.channel.fadeSpeed * 100;
  28.          _loc2_ = this.channel.fadeSpeed <= 0 ? Math.max(this.channel.fadeTo,_loc2_) : Math.min(this.channel.fadeTo,_loc2_);
  29.          if(_loc2_ == this.channel.fadeTo)
  30.          {
  31.             this.channel.fading = false;
  32.             if(this.channel.fadeOutFlag)
  33.             {
  34.                this.channel.stop();
  35.                this.channel.locked = false;
  36.                this.channel.playing = false;
  37.                this.channel.fading = false;
  38.             }
  39.          }
  40.          this.channel.setVolume(_loc2_);
  41.       };
  42.    }
  43.    function setVolume(volume)
  44.    {
  45.       if(volume != undefined)
  46.       {
  47.          this.volume = volume;
  48.       }
  49.       super.setVolume(Math.max(0,Math.min(100,this.volume * 100 * this.groups[this.group])));
  50.    }
  51.    function stop()
  52.    {
  53.       this.locked = false;
  54.       this.playing = false;
  55.       super.stop();
  56.    }
  57.    function onSoundComplete()
  58.    {
  59.       this.playing = false;
  60.       this.locked = false;
  61.       this.fading = false;
  62.    }
  63. }
  64.