-
attachsound fade problem
Hello,
I am busy with a presentation for a client that wants to have the soundloop faded to 0 when a button is clicked. (and faded back in when clicked on the same or another button) However, the sound effects in the rest of the movie need to keep playing on hover. I have used the following script:
backmusic = new Sound();
backmusic.attachSound("backsound");
backmusic.start(0,999999);
backmusic.setVolume(0);
vol = 0;
step = 1;
fade = 0;
onEnterFrame = function() {
// set fade out
if (fade == 1) {
vol = vol-step;
if (vol<0) {
vol = 0;
}
backmusic.setVolume(vol);
// set fade in
} else {
vol = vol+step;
if (vol>100) {
vol = 100;
}
backmusic.setVolume(vol);
}
}
And on the button:
(_root.fade=!_root.fade) ? 1 : 0;
When i click a button, it does not only fade the loop but all sounds. How to make it only fade the loop? (i tried: (_root.backmusic.fade=!_root.backmusic.fade) ? 1 : 0; on the button, but that doesn't work)
Please help.
Regards,
Marcus
-
FK'n_dog
simply using -
backmusic = new Sound();
ties the sound object to the root timeline.
modify one sound and all sounds attached to the root timeline responds
for individual control of sound objects, they need to be tied
to movieclip timelines -
this.createEmptyMovieClip("bm",1000);
backmusic = new Sound(bm);
this.createEmptyMovieClip("fm",1050);
foremusic = new Sound(fm);
hth
-
thanks,
only the loop is attached to the movie, the rest of the sounds are played in several movieclips within the timelines, so they are not "attached". can i just put the backsound in an empty movieclip and leave the rest like it is? And does the action when a button is pressed change?
on (release) {
(_root.fade=!_root.fade) ? 1 : 0;
}
to
on (release) {
(_root.bm.fade=!_root.bm.fade) ? 1 : 0;
}
or does that keep the same?
Thanks again.
Marcus
-
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
|