Guest User

Untitled

a guest
Jan 26th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. music = new Sound();
  2. music.attachSound("SOUND HERE"); // MUST give the sound file a name for AS
  3. music.start(0, 999999);
  4.  
  5. vol = 0;
  6. step = 1; // Amount to inc/dec the volume by each step
  7. fade = 0; // Do nothing
  8.  
  9. _root.onEnterFrame = function() {
  10.         // do fade out
  11.         if (fade == 2) {
  12.                 vol = vol-step;
  13.                 if (vol<0) {
  14.                         vol = 0;
  15.                         fade = 0;
  16.                 }
  17.                 music.setVolume(vol);
  18.         // do fade in
  19.         } else if (fade == 1) {
  20.                 vol = vol+step;
  21.                 if (vol>100) {
  22.                         vol = 100;
  23.                         fade = 0;
  24.                 }
  25.                 music.setVolume(vol);
  26.         }
  27. };
Add Comment
Please, Sign In to add comment