So, I'm trying to use actionscript more and more instead of using built in easy tweens...
I have a site I am building, its something like a picture gallery. I want the user to click on a button and have the image showing fade out and have the new one fade in.
I figured that I would need to call the new image by using what is, essentially, an empty movie clip. I cant figure out how to get the transparency to work for me without actually taking each and every image and tweening them individually. Is there a way to just write actionscript with a function that can be applied to each image, whther it is a swf or a jpg when it is called that will give the fade in/out effect?
Like I said, right now I have the buttons calling the images, but I would like to use actionscript so all I have to do is add images without having to edit each image.
Please help if u can
thanks!
D
thanks guys, i am still a little unclear though. Where would this actionscript go?
here is the only code i have right now - on a button that loads an image. I thought that if an image was loaded into a movie clip that it was supposed to take on that mc's attributes. But it doesnt appear to be working that way for me.
I used this script to create a fading images slideshow, you might find it useful - it has three buttons plus one fade in and one fade out function, used in setInterval. Also, you should place your movie clips each in its own layer, one atop another, and use this script in the main timeline:
code:
var mclipz = new Array (m1_mc, m2_mc, m3_mc, m4_mc);
var current = 0;
var fadingAction:Number;
plus_mc.onRelease = function() {
clearInterval (fadingAction);
fadingAction = setInterval (fadeOut, 30, mclipz[current]);
if (current >= mclipz.length) {
current = mclipz.length;
}
};
minus_mc.onRelease = function() {
clearInterval (fadingAction);
fadingAction = setInterval (fadeIn, 30, mclipz[current]);
if (current <=0) {
current = 0;
}
};
reset_mc.onRelease = function() {
for (i = 0; i <= mclipz.length; i++) {
mclipz[i]._alpha = 100;
current = 0;
}
};
function fadeOut(mcPlanet) {
mcPlanet._alpha -= 5;
if (mcPlanet._alpha <= 0) {
clearInterval (fadingAction);
current++;
}
updateAfterEvent;
}
function fadeIn (mcPlanet) {
mcPlanet._alpha +=5
if (mcPlanet._alpha >= 100) {
clearInterval (fadingAction);
current--;
}
updateAfterEvent;
}
I've also included my original fla (I used planets in slideshow, so instance & variable names are different, but the script is one & the same)