Fading background images into each other

i want to have a flash site where the background image is a building with a blue sky, i have created 5 other versions of this images each with a different color sky. i want to have buttons that are colored according the the different hues of the sky. upon clicking, i want the current backgound to fade out while the newly selected background fades in… ive tried a lot but have only a extremely minute understanding of actionscript - please help!!!

A simple motion tween will do it, without any AS… =)

One fades out while another fades in…

OR… make a symbol to mask over the sky, alpha to say 30%, then use tint to change the color of the mask over the sky, giving the illusion of the sky changing color…

I hope I explained clearly…

Rev:elderly:

i understand how to do it, but i want whatever the current pic is (even after changing it) to fade out and the new on fade in - im pretty sure it requires AS

As I said, use AS to change the tint of a symbol placed over the sky. you will still have to use a fade of some kind, but you can use a large space of bg color, then alpha it to 0% when you want to fade in…

That way, you only have 1 image, it stays where it is, you just fade in/out the block of color, then change the tint of the sky color… :ninja:

But, I still think it can be done without AS, but if you use more than 1 image, you will sacrifice file size and smoothness…

Rev:elderly:

well, the reason i have the seperate images is because there are things in front of the sky example

well if that link doesnt work type http://codeblackproductions.tripod.com/color_cycle.swf in your address bar…

yeah, I copied the link to see your example… Tripod does that… thanks for the example… =)

What I would do would be to separate the sky from the foreground, put it on a different layer, then tint that symbol…

But, if that isn’t what you are looking for, one of the scripting Gurus will help you out, I’m sure…

Rev:elderly:

thanks for your help, hopefully the scripting masters will stumble upon my post :slight_smile:

I hope so, I’ll bump it up to the top once more…

:stuck_out_tongue:

Rev:elderly:

You mean something like this???.. (but not exactly like this… same theory though)…

http://www.kirupa.com/developer/mx/alpha_fade.asp

no, i want the background image to be user selectable via buttons and i want whatever the current background image is to fade out while the newly selected image fades in - so no, not like that

well, i guess that is correct in theory - the fading, whole background at a time though, and by buttons rather than mouse movement

why not just make a MC for each image in each MC have a fade in and fade out. Put all the MCs stacked on top of each other with all but the first one on a blank or 0 alpha frame and then use gotoAndPlay(“frame_label”); to tell the one that is visible to play it’s fade out animation and the one you want to fade in.

i think that would work, but do you think you could go a little more indepth with your explanation? can you use the gotoAndPlay action to go to a certain frame within a movie clip if that button with that action assigned isnt in the movie clip you want to control?

First Create a MC for each background with a fade in animation and a fade out animation. Start your original background on a frame where it is completely faded in. Start all the others on a frame where they are faded out.

Now you are going to need some variables to know which background is currently showing. There are 2 ways you could do this: 1) one variable which you put the name of the current color in or 2) several variables one for each MC which tells if it’s on or off.

Then you need to create a function with an if statement for each movie to determine if the background is visible. If it is then we need to fade it out by using the gotoAndPlay command.

Add this function with another gotoAndPlay command to fade the selected color in to your buttons and it should work.

If you have any questions about how to code anything check the Actionscript dictionary under help and if you’re still lost ask and I’ll try to answer it. If I have time I’ll see about creating you a basic fla so you can see how it works.

It works, was actually fairly easy to do, I put each background on a different layer so it’s easier for you to see but you could have them all on the same layer if you wanted.

Ding Ding Ding :slight_smile:

thanks so much for the advice, i will try it later tonight - if you could make an example fla, id be in your debt, that would help me a lot

i am planning on buying an actionscripting book, so i can get a better understanding the language

thanks again for your help

heh, didnt see second page - im such a forum newb, thanks so much!