Canvas. I created a
Spriteobject which I used to do the drawing. At first I was drawing each rectangle like this:
But I noticed when I was drawing hundreds of rectangles over time (using a
Timerobject to paint new rectangles every few hundred milliseconds) this got to be pretty slow.
So my next attempt to improve performance was to cache a
BitmapDataobject for each rectangle (they are all the same size) of a certain color:
This definitely improved the performance a lot, now I can draw hundreds of rectangles, but I still noticed that the rendering would slow down after a few minutes. Thankfully I came across this posting on Nabble: http://www.nabble.com/-INFO--FLEX-Effects-slowing-down-with-time-td20770945.html
Perhaps this is obvious to most people, but I was never calling
graphics.clear()! So over time my sprite's graphics object was getting filled with thousands of rectangles to paint. As soon as I added
updateDisplayList()function it worked perfectly.