Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- music = new Sound();
- music.attachSound("SOUND HERE"); // MUST give the sound file a name for AS
- music.start(0, 999999);
- vol = 0;
- step = 1; // Amount to inc/dec the volume by each step
- fade = 0; // Do nothing
- _root.onEnterFrame = function() {
- // do fade out
- if (fade == 2) {
- vol = vol-step;
- if (vol<0) {
- vol = 0;
- fade = 0;
- }
- music.setVolume(vol);
- // do fade in
- } else if (fade == 1) {
- vol = vol+step;
- if (vol>100) {
- vol = 100;
- fade = 0;
- }
- music.setVolume(vol);
- }
- };
Add Comment
Please, Sign In to add comment