Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

fade out, go to "" and fade in - this must be possible...?

Status
Not open for further replies.

countrywide

Technical User
Nov 25, 2008
5
GB
It feels like this should be simple...

Designing a menu for a website, and would like to fade out whatever is on the (body part of the) screen, go to the new frame (specified from the menu) and fade that in...

I could do it with motion tweens, but I'd have to work out each and every transition... there must be a better way!

There's a frame and a menu system that I don't want to fade, just a selection of the screen...

Any help greatly apreciated.
 
I've found this which works really well to fade out a movie clip... how could you change it to fade it in?

img1_mc.onEnterFrame = function() {
img1_mc._alpha -= 5;
if (img1_mc._alpha <= 0) {
img1_mc._visible = false;
delete img1_mc.onEnterFrame;
}
};
 
hmm this doesn't seem to work, the movie appears, but doesn't fade in...

I notice if I change the initial code line 2

img1_mc._alpha -= 5;

changing the 5 to a lower figure slows the speed of the fade out, however can't do the same thing with the fade in... (I wondered if it was fading so fast I couldn't see it)

I'm afraid it's all a bit change it and see what works... and I can't make it work!!!

here's what I've put in for the movie...

testmap.onEnterFrame = function() {
testmap._alpha += 5;
if (testmap._alpha >= 100) {
delete testmap.onEnterFrame;
}
};



then a bit later on...



testmap.onEnterFrame = function() {
testmap._alpha -= 5;
if (testmap._alpha <= 0) {
testmap._visible = true;
delete testmap.onEnterFrame;
}
};



the second fade out works, but not the initial fade in...?

 
Well the initial alpha of the clip must have been set to 0, so that it can be faded in...

If the alpha of the clip is already at 100%, then obviously the fade in doesn't need to occur...

Either set the clip's alpha to 0% within itself to start with...

this._alpha = 0;

Or set it to 0% on the timeline, prior to your fade in script...

testmap._alpha = 0;

testmap.onEnterFrame = function() {
testmap._alpha += 5;
if (testmap._alpha >= 100) {
delete testmap.onEnterFrame;
}
}


Regards. FLASH HELP - OPENED FOR BUSINESS!
TO GET YOUR OWN FREE WEBSITE HOSTING
 
Now that makes perfect sense, and low and behold it works too!

thanks very much indeed
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top