jeudi 24 septembre 2015

How to stop an effect from one frame to continue in the next?

I have made a program in which small green rectangles (or Greeny here) are periodically generated at the bottom of the screen and inside the movie clip symbol, I have made a classic tween such that it moves to the top of the screen. I have also declared a variable (t) that increments itself periodically (I am running it at 24 fps). When the value variable, t reaches or exceeds 96, it moves to the next frame. The problem however is that even in the next frame, the generation of these small green rectangles do not stop. Please do excuse me if I have asked the question wrongly. By the way the code on frame 2 is just stop();. Here is the code for frame 1-

var c:int;
var t:int = 0;
var s:int = 8;
function eFrame(event:Event):void
    if (t%s == 0)
        var i:Greeny = new Greeny  ;
        i.x = Math.random() * 550;
        i.y = 400;
    if (t > 96) {
this.addEventListener(Event.ENTER_FRAME, eFrame);

Aucun commentaire:

Enregistrer un commentaire