Fade in loop?

This is a follow up question to an earlier thread. Someone helped me with some code, but actually made it to difficult for me to understand.
I want to fade the pictures in this loop in:

for (i=1; i<=6; i++) {
    loadMovie("images/image"+i+".jpg", "container_"+i);
    this["container_"+i].onload = function() {
        this["container_"+i]._alpha = 0;
    };
}

Searched for examples, but couldn’t find a simple one(drives me crazy!)

thanks

regards

*wanted to post in AS forum but made mistake. Is it possible to move it there?


for (i=1; i<=6; i++) {
mc = this["container_"+i];
mc.loadMovie("images/image"+i+".jpg");
mc.onload = function() {
this._alpha = 0;
};
mc.onEnterFrame = function(){
this._alpha < 100 ? this._alpha += 10 : delete this.onEnterFrame
}
}

:slight_smile:

Thanks Voetsjoeba,

For some reason it doesn’t work. My code is probably wrong in the first place.
Included the file with the pics:

www.inflicted.nl/pictures.zip

Hope you can help

regards

function preload() {
	var loaded = this.temp_mc.getBytesLoaded();
	var total = this.temp_mc.getBytesTotal();
	this.onEnterFrame = loaded>0 && loaded == total ? fadein : preload;
}
var fadespeed = 10;
function fadein() {
	this._alpha = Math.min(100, this._alpha+fadespeed);
	this.onEnterFrame = this._alpha == 100 ? undefined : fadein;
}
for (var i = 1; i<=6; i++) {
	var mc = this["container_"+i];
	mc.createEmptyMovieClip("temp_mc", 0);
	mc.temp_mc.loadMovie("images/image"+i+".jpg");
	mc._alpha = 0;
	mc.onEnterFrame = preload;
}

Kode!
This is great!
What I don’t understand is that you create an empty MC, “temp_mc” and the images still load in the container_MC’s.
Could you explain a little?

Thanks a million

regards

That’s because the empty movie clip, temp_mc, is created inside the other movie clip, container_#!! :wink:
Run a search in the forum if you want the whole explanation, it’s been asked many times.

And you’re welcome. :stuck_out_tongue:

Thanks to Voetsjoeba also…

regards