This content has been marked as final. Show 3 replies
you can't use a for-loop (or two of them) to display animation on-stage. for-loops (and while-loops) execute from beginning to end before the stage is refreshed.
so, break your for-loops into an onEnterFrame or setInterval() loop.
So ive slightly modified the code with a setInterval inside the for loop. The code works but i am unable to clear the intervalID once i finish. I am getting to the condition to clear the setInterval but it's not working. Any ideas?
that's a mess. you're creating Math.floor(defining box._height/blockSize) * Math.floor(box._width/blockSize) intervals all with the same id and that logic is faulty.
store you mc movieclips in an array and after your for-loops complete, execute one setInterval() that iterates through your array.