Groups | Blog | Home
all groups > flash actionscript > march 2006 >

flash actionscript : newbie question...fade in/out


shmooney
3/3/2006 4:45:24 PM

[quoted text, click to view]


why use any action script? just create a movie clip with the box in
question. Click on frame one and create a motion tween. Create a key frame
at 5, 10, and 15. Click on frame one, click on the box, and then in the
properties at the bottom, change alpha to 0%. On frame 15 do the same thing.
Viola, a box that fades in and out.

Powercats22
3/3/2006 9:23:30 PM
I'm trying to do something EXTREMELY simple, but all of my ideas run into dead
ends. I simply want to have a box fade in and then fade out. No problem, right?
If someone could give me a hand, that would be great.

So far, I can get my box to fade in. The box is a mc on layer 1 and the AS is
on an actions layer. My best idea is to run the alpha from 0 to 100, and then
at 100% trigger the opposite direction. I thought I could do this in one frame,
but it always ends in a loop fading from something like 80%-90%-80%...so on. So
then, I come up with at 100% alpha, move to frame 2 and fade out. For some
reason, I can get it to stop and fully run frame 1 before jumping to 2.

Here is my code on an actions layer on frame 1:

(stop);
box01._alpha=0
box01.onEnterFrame = function() {
if (this._alpha<=99){
this._alpha+=10;
}
if (this._alpha==100){
gotoAndPlay(2)
}
}

Any brilliant ideas out there to help me out?
Thanks in advance
sly one
3/3/2006 9:37:15 PM
Have you thought about using the Tween class? It gives you an easy way to do a "yoyo" tween (without any timeline gyrations).

AddThis Social Bookmark Button