I have a presentation, that plays a sound loop, over and over throughout the movie…(guess that’s why they call it a loop )
Here’s my problem:
On the first frame of my Main movie timeline…I have this code:
[AS]
firstSound=new Sound();
firstSound.attachSound(“musicloop01”);
myLoopVolume=50;
firstSound.setVolume(myLoopVolume);
_root.firstSound.start(0,999);
[/AS]
I also have a vertical volume control MC on the main time line with the following code:
[AS]
onClipEvent(load) {
left=_root.base._x -6;
top=_root.vslider._y + 50;
right=_root.base._x -6;
bottom=_root.vslider._y - 50;
volCalc=_root.vslider._y - 50
}
onClipEvent(enterFrame) {
vslidery=_root.vslider._y;
_root.firstSound.setVolume(100-(vslidery-volCalc));
}
//
onClipEvent(mouseDown) {
startDrag(this, false, left , top , right, bottom);
}
//
onClipEvent(mouseUp) {
this.stopDrag();
}
[/AS]
So far so good, everything works…
However,
I wanted to fade this loop out at the end of the last movie…so…I entered this code…attached to a MC somewhere down the timeline:
[AS]
// set up variables on load
onClipEvent(load){
so = _root.firstSound; // object, not string
rate = 1;
startFadeOut = true;
}
// fade out loop
onClipEvent(enterFrame){
if(startFadeOut){
if(so.getVolume() > 0) {
so.setVolume(so.getVolume() - rate);
} else {
so.setVolume(0) // prevent negative values
startFadeOut = false; //stop loop
}
}
}
[/AS]
Well, WITHOUT, the volume control MC, the fade out works…perfect…depending where it is on the time line…when it reaches it , it fades.
However, WITH the volume control, fadeout doesn’t do anything…
I really need to get this to work, I’ve read many tutorials here and on Flashkit, but none of them addresses this issue with the fade out AND volume control together.
It doesn’t help that I’m new to the whole sound object thing.
Any help would be greatly appreaciated!!!