PDA

View Full Version : fade in and out


jaredly
12-14-2002, 04:56 PM
example

ecko.com (http://ecko.com/)
then go to life & style
then fall 2002

I want to have a portfolio with the same effect they have with each image fadeing out on top of the next one.

I know they are loading in external jpg.

If any one has a good idea on how to do this,or has a tutorial I would be great full.

Thanks

pixelwit
12-15-2002, 01:07 AM
Not sure what version of Flash you have, (guessing you have MX since you mentioned loading JPG's) but the general concept is this:

Load all JPGs into a stack of clips, one on top of the other.
As they load set their alpha and visibility to 0.
Create a single variable (on the _root maybe) called curClip to store a reference to the currently active clip.

Now for the fun part:var step = 10;
var oldClip;
function fadeOut(){
this._alpha-=step;
if(this._alpha<=0){
this._alpha = 0;
this._visible = false;
this.onEnterFrame = null;
}
}
function fadeIn(){
this._alpha+=step;
if(this._alpha>=100){
this._alpha = 100;
this.onEnterFrame = null;
}
}
function showClip(newClip){
if (newClip!=oldClip){
var n = newClip;
var o = oldClip;
newClip._visible = true;
n.onEnterFrame = function(){
fadeIn.call(n);
}
o.onEnterFrame = function(){
fadeOut.call(o);
}
oldClip = newClip;
}
}I've attached a file showing it in action.

Hope it helps,

-PiXELWiT
http://www.pixelwit.com

jaredly
12-16-2002, 02:38 AM
Thanks for the files you sent me. This is exactly what I was looking for. I took a look at your site, very nice work. I will let you know when I get my site done so you can see how I used the example you gave me.

Thanks again.

jaredly
12-17-2002, 04:45 AM
I have flash mx but I want to publish my swf as flash 5. After I do this, the code does not work any longer. What do I need to change to make it work in flash 5.

pixelwit
12-17-2002, 10:34 AM
onEnterFrame is an MX only feature.

You need to find a way to execute the actions within the onEnterFrame events using looping movieclips. It's not the easiest thing to do but it can be done. You might be able to find out something about it if you search for "code engine", script clip" or "process clip".

One way to do it is to attach clips which repeatedly execute the onEnterFrame actions, then instead of making onEnterFrame=null you'd just remove the attached clips.

Hope it helps,

-PiXELWiT
http://www.pixelwit.com

jaredly
12-17-2002, 01:45 PM
Thank again. I will see what I can find.

jaredly
12-18-2002, 04:47 AM
mcartordesign.com (http://www.mcartordesign.com/mdc_v2)

This is how I am useing your fader. It works great. But I am having some problems with the images jumping a little. Have you ever seen this befor? Do you have any Idea why it is doing this. I have the jpegs zeroed out and that did not help.

The dimensions of the jpeg are 360x225.

jaredly
12-20-2002, 03:14 PM
To fix that jumping problem, I changed the alpha to 99% It worked great.

check it out (http://www.mcartordesign.com/mdc_v2)