TK Event Engine "bigLoop" Add-on v1.06


Download the source file

Suppose you want to execute nested for-loops such as:


    for (k=0; k<=5; k++) {
        for (j=0; j<=5; j++) {
            for (i=0; i<=5; i++) {
                trace(k + " " + j + " " + i);
            }
        }
    }

This "bigLoop" add-on helps in such a case especially when the iteration numbers are large.
It first iterates the innermost loop (i.e. k=0, j=0, i:0 to 5) in one frame,
then go to the next frame and iterates the innermost loop again there (k=0, j=1, i:0 to 5).
It loops until k=5, j=5 and i=5 in that manner.
This add-on supports up to 3 nested loops.

The syntax for 3 loops (See Usage example 1 in frame 2 of the fla):

eventEngine.subscribe("enterFrame", "_level0.bigLoop", {func:myFunc, iMin:0, iMax:5, jMin:0, jMax:5, kMin:0, kMax:5});

The syntax for 2 loops:

eventEngine.subscribe("enterFrame", "_level0.bigLoop", {func:myFunc, iMin:0, iMax:5, jMin:0, jMax:5});

The syntax for 1 loop (It wouldn't make sense to use eventEngine in this case, though):

eventEngine.subscribe("enterFrame", "_level0.bigLoop", {func:myFunc, iMin:0, iMax:5});



In order to execute one big loop, you can devide it into pieces like 1000 times per frame, and use the syntax for 2 loops.
(See Usage example 2 in frame 2 of the fla)


Back to Flash Home

Copyright©2000-2002 STUDIO FIRST RAYS. All rights reserved