Skip to main content
Known Participant
July 28, 2010
Question

swf file disappear from the screen

  • July 28, 2010
  • 2 replies
  • 575 views

We have a problem with a code as below made in AS2. By some reason 3-4 minutes after appearance the image disappear from the screen. Please, advise, where is the error?

var picTotal:Number = 1;
var lightSpeed:Number = 5;
var delay:Number = 5000;
var count:Number = 0;
function init():Void {
var white:MovieClip = this.createEmptyMovieClip("wh", 10);
with (white) {
beginFill(0xFFFFFF);
lineTo(Stage.width, 0);
lineTo(Stage.width, Stage.height);
lineTo(0, Stage.height);
lineTo(0, 0);
endFill();
}
white.blendMode = "add";
lightSpeed = -lightSpeed;
showNext(white);
}
function showNext(clip:MovieClip):Void {
clip.onEnterFrame = function():Void {
this._alpha += lightSpeed;
};
}
init();

This topic has been closed for replies.

2 replies

Ned Murphy
Legend
July 28, 2010

The code instantly turns lightSpeed from +5 to -5 ( lightSpeed = -lightSpeed; ) before any onEnterFrame processing gets done, so the alpha value is being rediuced from the get go ( this._alpha += lightSpeed; ).

alexee77Author
Known Participant
July 28, 2010

Hello,

I'm novice and make a code on the basis of edition of other codes.

If possible, could you change the code correctly, in order the picture loaded does not disappear after some period of time.

July 28, 2010

This is an AS3 forum - you'd be better served in the AS2 forum.

That being said, I'd trace lightSpeed in your enterFrame to make sure you're setting alpha to a valid value.