|
-
Prid - Outing
Well, that's ALOT more complicated, and someone else, recently, wanted to achieve the same thing. I used some time writing a long code, so if you want it, you can have it - though, I can't explain it right now, because I have to do something, but here it is:
Let's say you have 3 Buttons. On your first button, add this code:
Code:
on(press){
_root.btn(1, "sound1");
}
The number 1 is nothing you should be worried about, but the "sound1" is the sound's linkage name. So for the rest of the buttons, add this code on them too, but for each button, increase the number 1 - so, for example you have 3 buttons, on button 3, you'd have this code:
Code:
on(press){
_root.btn(3, "my_awesome_sound");
}
"my_awesome_sound" is the Linkage name of a sound in the Library, and see that I increased the number to 3, for button 2, I'd write number 2!
But, for the real magic to happen, paste this code on your Frame:
Actionscript Code:
speed = 20; // change this number to change speed of fading checker = false; cur_sound = "";
function btn(i, my_sound){ this["sound"+i] = new Sound(); this["sound"+i].attachSound(my_sound); _root.cur_sound = this["sound"+i]; my_cur_sound = this["sound"+i]; cur_volume = _root.cur_sound.getVolume(); onEnterFrame = function(){ vol = _root.cur_sound.getVolume(); if(vol <= 0 || _root.checker == false){ my_cur_sound.stop(); this["sound"+i].start(0,1); delete onEnterFrame; _root.checker = true; myVolume = 0; onEnterFrame = function(){ if(myVolume <= 99){ myVolume += speed; this["sound"+i].setVolume(myVolume); } else { this["sound"+i].setVolume(100); delete onEnterFrame; } } } else if(vol > 0){ cur_volume -= speed; my_cur_sound.setVolume(cur_volume); } } }
I know, this code is huge, but I am proud that I wrote it by myself ^^
But, for this code to work, you'll have to give your first sound, the linkage name of sound1, your second, sound2, sound3, etc.
Now, check those buttons, and see if it is what you want. I'll be busy in 30 minutes now, so don't expect an answer until then if you have any further questions - hope this help you
Last edited by Nig 13; 07-11-2011 at 09:54 AM.
I am back, guys ... and finally 18 :P
BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|