Skip to main content
February 5, 2008
Question

Bitmap Tiling Problem: Need to display image randomly with tiles

  • February 5, 2008
  • 2 replies
  • 372 views
What im trying to accomplish is cut up an image into squares and then display the squares randomly from the top down at different intervals. The effect will be quick and the squares will not animate in, but just appear at random times from the top of the image till the whole image is complete. This code works but i am having problems getting the squares to show up at different intervals. Any help would be appreciated. Thanks!
This topic has been closed for replies.

2 replies

kglad
Community Expert
Community Expert
February 5, 2008
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.
kglad
Community Expert
Community Expert
February 5, 2008
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.
February 5, 2008
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?