dimanche 21 février 2016

Flash hangs when I execute this particular loop

Please do forgive me if this question is very stupid, but I couldn't figure out what to do, which is why I ask it. Here, I declared a small white square as a movieclip symbol(Dot) and I wish to generate it after a specific gap on the entire screen. So, when I execute this (test it) code on Flash CS6, it hangs. After that I will be forced to end the program without doing anything further.

import flash.ui.*;
stop();
Mouse.hide();
var ctX:int = 0,ctY:int = 0,done:Boolean = false;
var base:Object = MovieClip(root);
this.addEventListener(Event.ENTER_FRAME, eFrame);
function eFrame(event:Event):void
{
    while (done == false)
    {
        var dots:Dot = new Dot  ;
        dots.x +=  (50 * ctX);
        dots.y +=  (50 * ctY);
        ctX++;
        if (ctX == 11)
        {
            ctX = 0;
            ctY++;
        }
        else if (ctX == 11 && ctY == 10)
        {
            done = true;
            break;
        }
        stage.addChild(dots);
    }
}

Thank you in advance. I have attached a screenshot of the situation.

Aucun commentaire:

Enregistrer un commentaire