Hi.
I’m making a Catalogue to be distributed on a CD, and I want to provide an elegant way to exit the Catalogue.
So I made a separate “exit.swf” movie to be loaded over the main catalogue movie.
it have a dark transparency and a goodbye message. Looks very good.
Also, at the same time I want that the background music fade out smoothly until the movie exits.
To achieve this I had put an event .wav sound on a frame at the begining of the movie, with an instance of a “back music” movie clip on the same frame.
Also I have this code on the same frame:
// create Sound object
globalsound = new Sound(); globalsound.setVolume(100);
If I wanted to fade out the background music, I only have to put this code before an exit frame:
// create Sound object
var snd:Sound = new Sound(music);
trace(music);
// start fade
this.onEnterFrame = function() {
// get current volume
var vol:Number = snd.getVolume();
// if volume is larger than 0, decrease it, otherwise stop fade
if (vol>0) {
snd.setVolume(vol-3);
} else {
delete this.onEnterFrame;
}
};
But, because I want that the “Exit” button do all the things, no mather were in the movie the user is, I thought I may put all the instructions on the same button.
So, I want the “exit” button to load the #exit.swf" movie and at the same time fade out the music and exit the movie.
I tryed the following code on the button:
on (release) {
loadMovieNum("imagens/exit.swf", 1);
}
// create Sound object
var snd:Sound = new Sound(music);}
trace(music);
{
}// start fade
this.onRelease = function();
// get current volume
}
var vol:Number = snd.getVolume();
{
}// if volume is larger than 0, decrease it, otherwise stop fade
if (vol>0) {
snd.setVolume(vol-3);
} else {
delete this.onRelease;
}
}
But it gives me one (1) error on Line 5.
I had spent hours making tests and I can’t figure out what’s wrong.
I’m not a Action Script guru; I only search for code and try to adapt to my projects.
Note that I changed the
this.onEnterFrame
to
this.onRelease
Could someone please help me to find the error?
Thank you