Fading one jpeg in on top of another on(press)

I have looked all over this forum and can’t find what I am looking for (though undoubtedly someone will point me to another thread.)

I have a dozen buttons of materials options. When the user hits one I want an external jpeg to fade into a fix position mc, over the previous jpeg their. And as the user keeps hitting the buttons jpeg upon jpeg will fade in on top.

I am using

init = function () {
Img1.myContainer = Img1.createEmptyMovieClip(“cont”, 1);
Img1.myContainer.loadMovie(_global.imagename);
};

and

on(press) {
_global.imagename = “myImage.jpg”;
init();
}
.

But this just pops the next image in with a gap in between.

Don’t I have to create movieclips one level higher than the previous, then after fade up of alpha, unload previous mc. I don’t want dozens of mcs to just keep layering one on another?

A preload would be nice for the future (without a status message.) But for now the app runs locally.

Thanks for any help

Ron R. Jr.

P.S. I tried using http://www.kirupaforum.com/forums/showthread.php?s=&threadid=33872 but I am not sure if it does what I need as I could not figure out how to point the functions to an external mc. I replaced all instances of “this” text with “Img1” to point them to my _root.Img1 mc but the fadeIn function did not work.

create a moviclip oMovie
in that put 2 movieclips (imgHolder1, imgHolder2) in different levels.
set _alpha of both to 0 so now both are invisible.
in the main timeline
imgHolder1.loadMovie(“1.jpg”);
imgHolder1._alpha=100;
displayedimage=“imgHolder1”;

now when a button is clicked,
if(displayedimage==“imgHolder1”) {
displayedimage=“imgHolder2”;
}
this[displayedimage].loadMovie(“2.jpg”);
this[displayedimage].swapdepths(1000);
this[displayedimage].fadeIn

see what i mean ?

this[displayedimage].fadeIn

where is the fadeIn function?

If I set the alphas to 100 then I get the pictures switching with out gaps. If I add:

if(displayedimage==“imgHolder1”) {
displayedimage=“imgHolder2”;
} else {displayedimage=“imgHolder1”;}

But now I need the fadeIn effect.

Thanks for fast reply. I know I’m close.

Ron R. Jr.

Is this close???

function fadeIn () {
if (this[displayedimage]._alpha < 100) {
this[displayedimage]._alpha += 1
//The higher the number the faster it fades
} else {
clearInterval (time)
}
}
time = setInterval (fadeIn, 50)

maybe or you can use tweening inside the imgHolder movieclips.

might be easier.

I am attempting to do something very similar but am having trouble getting it to work. If you did manage it and have the code or file on hand it would be much appreciated if I could take a look.
Thanks
erok