home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Acao / gladiator_castle_war.swf / scripts / frame_3 / DoAction.as
Encoding:
Text File  |  2007-03-15  |  986 b   |  41 lines

  1. stop();
  2. if(!bgsndmc)
  3. {
  4.    bgsnd = new Sound();
  5.    bgsndmc = _root.createEmptyMovieClip("bgsndmc",_root.getNextHighestDepth());
  6.    bgsnd.setVolume(0);
  7.    vol = 0;
  8.    curvol = 70;
  9.    changeBGMusic = function(music)
  10.    {
  11.       bgsndmc.toplay = music;
  12.       vol = bgsnd.getVolume();
  13.       bgsndmc.onEnterFrame = function()
  14.       {
  15.          vol -= 5;
  16.          if(vol < 0)
  17.          {
  18.             bgsnd.stop();
  19.             if(this.toplay !== undefined)
  20.             {
  21.                bgsnd.attachSound(this.toplay);
  22.                bgsnd.start(null,128);
  23.             }
  24.             vol = 0;
  25.             bgsndmc.onEnterFrame = function()
  26.             {
  27.                vol += 5;
  28.                if(vol > curvol)
  29.                {
  30.                   vol = curvol;
  31.                   delete this.onEnterFrame;
  32.                }
  33.                bgsnd.setVolume(vol);
  34.             };
  35.          }
  36.          bgsnd.setVolume(vol);
  37.       };
  38.    };
  39. }
  40. changeBGMusic("menumusic");
  41.