Alpha fade using actionspirt

I am using this code:

on (release) {
unloadMovie(“content”);
}
}
on (release) {
loadMovie(“linkbank/linkpool/art.swf”, “content”);
}

However, when it unloads its not smooth, its sudden. How do you made the current object loaded in “content” fade alpha and then once it reach 0 load the next clip? Keeping in mind that i want it all in a scirpt form that i can easy add to a button.

thanks! love ya

using a for loop, set interval and movieclip._alpha from 100 to 0 (when it reaches 0 load the mc)


fader = function(what) {
what._aplha > 0 ? what._alpha -= 10 : what.unloadMovie();
}
on (release) {
fader(content);
}

ps
should it also fade in when loading another movie???

it sats there a syntax errors:
fader = function(what) {
what._aplha > 0 ? what._alpha -= 10 : what.unloadMovie();
}
on (release) {
fader(content);
}
on (release) {
unloadMovie(“content”);
}
on (release) {
loadMovie(“linkbank/linkpool/art.swf”, “content”);
}

I corrected some of the spelling:
fader = function(“what”) {
what._alpha > 0 ? what._alpha -= 10 : what.unloadMovie();
}
on (release) {
fader(“content”);
}
on (release) {
unloadMovie(“content”);
}
on (release) {
loadMovie(“linkbank/linkpool/art.swf”, “content”);
}

BUT it still has errors: HERES the output
Symbol=linkpool main content, Layer=buttons, Frame=1: Line 1: Parameter name expected
fader = function(“content”) {

Symbol=linkpool main content, Layer=buttons, Frame=1: Line 2: Statement must appear within on handler
what._alpha > 0 ? what._alpha -= 10 : what.unloadMovie();

Symbol=linkpool main content, Layer=buttons, Frame=1: Line 3: Unexpected ‘}’ encountered
}

wait… can you make it like you said before. It loads in but fades in but when another button is selected it will fade the current loaded movie and fade in the selected? so that its nice and smooth.

ALSO when preloading my main file is there a way to preload extnernal files?

MovieClip.prototype.fadeAndUnload = function(rate) {
	this.onEnterFrame = function() {
		if (this._alpha > 0) {
			this._alpha -= rate;
		} else {
			delete this.onEnterFrame;
this.unloadMovie();
		}
	};
};


myMovieClip.fadeAndUnload(10);

where do i put each script?

that will fade out the current loaded movie clip i guess. How about loading in the next one automatically after the movie clip has finished fading out?

Dreamer, take a look at photogallery tutorial, there’s exactly what you need:whistle:

scotty(-:

KOOL! thanks a lot scotty!

no problem:thumb: