Sunday, September 02, 2007

Drawing Limit on Sprites

I learning something new this weekend. When drawing on a Sprite in ActionScript 3, I assumed you were just drawing on it like you would a graphics port and the result was just changed pixels in memory. Ah, but after some pain (and a SWF freezing at exactly the same time each time I ran it) I found it keeps track of the number of things you've drawn on it.

How many items does it keep track of? The nice computer-y number 65536, aka 2^16 or 0x00FFFF. Before you reach that limit you should call the clear() function of the graphics object of your sprite, ie:;
But now with that past, I've got the beginnings of a nice 2d terrain generator.