Skip to main content
March 14, 2008
Question

Stop Alpha fade loop

  • March 14, 2008
  • 2 replies
  • 208 views
I have a bit of ActionScript for an image alpha fade, but for some reason it loops. After a while, the picture that fades up disappears, then cycles through again. Does someone know a way to have this script not loop?

this._alpha = 0;
this.onEnterFrame = function() {
if (this._alpha == 100) {
delete this.onEnterFrame;
} else {
this._alpha += 30;
}
};
This topic has been closed for replies.

2 replies

March 14, 2008
Simple as that. Thanks.
Inspiring
March 14, 2008
Put a trace inside the onEnterFrame and before the conditional.

trace(this._alpha)

You are going to see that the alpha isn't doing exactly what you think.

In general with any kind of property test for a movieclip you won't want to use == instead you should use >= or <=.