PDA

View Full Version : [FMX] Alpha tween with action script?



dboers
February 2nd, 2004, 07:07 AM
Is it posible to realize a alpha tween effect between two images with an interval of let'ssay 7 seconds, based on ActionScript. And is so how is that actionscript look likes?:smirk:

claudio
February 2nd, 2004, 08:53 AM
You want the whole effect (pic1 fade out -> pic2 fade in) to last 7 seconds?

dboers
February 2nd, 2004, 09:58 AM
No I want every photo to last 7 seconds. The fade in fade out can take about two or three seconds!:pleased:

Adam
February 2nd, 2004, 06:00 PM
I did this recently with four pictures. I put four keyframes in each MC which contained a picture. I set the frame rate at 25 fps. In the first keyframe I put:

stop();
this._alpha=0

second:

this._alpha += 4;
if (this._alpha >= 99) {
gotoAndStop(4);
}

third:

this._alpha += 4;
if (this._alpha >= 99) {
gotoAndPlay(2);
} else {
gotoAndStop(4);
}

fourth:

stop();
function goOn() {
_root.pic2.gotoAndPlay(2);
}
setInterval(goOn, 7000);

The "7000" in the bottom pauses that frame for 7 seconds, and then calls the function that fades in the second picture.

In the first frame of the main movie I put:
function now() {
pic1.gotoAndPlay(2);
}

And then I called it in the second with this:
now();
gotoAndPlay(1);
which starts the whole process. Keep in mind that I've still got 24 days left on my trial of mx2004, so I'm still new, and have just jumped from flash 5...so there might be a better way, but this worked for me.

Good luck,
Adam