PDA

View Full Version : alpha fade image, wait, fade out, next frame


cruiserparts
12-29-2002, 08:57 PM
Greeting,

After three hous of review I have now looked at so many scripts (here and elsewhere) of fading in/out that I am more confused instead of less confused, which seems odd I know.

Here is what I have and what I want to do. I am using MX.

I have twenty images, one one each frame of a movie clip, placed around the stage. I want the imges placed instead of loaded so that I can control where they appear on the stage. I would like each image to fade in, stay on the stage for 4 seconds, fade out, and then go to the next frame (and repeat with the image located on that frame). Does anybody have any scripts that already do this. I am a beginner and I am not that famaliar with action scripting. I think what I need to do is use an onEnterFrame, with an alpha fade in, some type of delay/counting script, and then a fade-out, and go to the next frame.

I know that you all have thousands of things you could be doing instead of helping me, so please know that I appreciate it.

Billy T
12-29-2002, 10:17 PM
Originally posted by cruiserparts
I want the imges placed instead of loaded so that I can control where they appear on the stage.

Hi there

you can position loaded images...

anyway, for the fader try something like this

in frame 1 put

stop();

then on each mc put

onClipEvent(load){
fadeIn=true;
i=0;
_alpha=0;
}
onClipEvent(enterFrame){
if(fadeIn && _alpha<100){
_alpha+=5;
}
if(!fadeIn && _alpha>0){
_alpha-=5;
}
if(_alpha>90){
i++;
}
if(i>60){
fadeIn=false;
}
if(!fadeIn && _alpha==0;
_parent.gotoAndStop(_parent._currentframe+1);
}
}

bit messy but should work ok

cheers

cruiserparts
12-29-2002, 11:56 PM
Hey Billy,

Thanks. I have been messing with the script. It definately has potential. I'm not sure that I have my timeline set up to match the demands of the script though. Here is what I have. See what you think. I think I might need to convert the individual images to movie clips to use this script.

Currently, the swf has a preloader and then after it loads, it goes to frame 10, where the MC, "myFavs_mc", is dragged onto the stage (and a stop action). 20 of the images are stored in the myFavs_mc as 20 successive frames. When I put the script you gave on the myFavs_mc instance, the first images fades in, waits, and then fades out (perfect), but then it never goes on to the second image. Do I somehow need to set up my timeline and the myFavs_mc differently. I am wondering because you mentioned something about "then on each mc put (the script)" but I only have one mc??? Is your script intended to fade the whole script in and out or does it fade the individuals images in and out?

any ideas?

Thanks,
jon

Billy T
12-30-2002, 01:41 AM
yep each image needs to be an mc with that code on it

cheers

boyzdynasty
12-30-2002, 02:30 AM
i tried to post the file...but it tells me its too big.
:(

if you want the file i did, e-mail: [email protected]

what i did was....

/*
I have two layers: 1st- Actions and 2nd-to hold the MC (I named it gallery)
Total of 3 frames
*/

// Frame1 in action layer
fadeIn = "0";
fadeOut = "100";
setProperty("_root.gallery",_alpha, fadeIn);

// Frame2 in action layer
if( fadeIn != "100" )
{
// Start fading in the movieClip - gallery
fadeIn++;
setProperty("_root.gallery",_alpha,fadeIn);
}
if( fadeOut != "0" && fadeIn == "100" ){

// Start fading out the movieClip - gallery
fadeOut--;
setProperty("_root.gallery",_alpha,fadeOut);
}
// If the frame of that movie clip has been fadeIn
// and then faded out,
// Go to the next frame and start the process all over again
if( fadeOut == "0" && fadeIn == "100" ) {
fadeOut = "100";
fadeIn = "0";
// Check to see if the movieClip reach the last frame
if(_root.gallery._currentframe != _root.gallery._totalframes){
_root.gallery.gotoAndStop(_root.gallery._currentfr ame+1);
}
// If it did reach the last frame, start from the begining
else{
_root.gallery.gotoAndStop(1);
}
}


// Frame 3 in Action layer
gotoAndPlay(2);