BitmapData pool class.

Notes on implementation:

get() starts searching for a suitable BitmapData from the start of the pool list
put() adds the BitmapData to the start of the pool list (removing the last one if the pool exceeds maxLength)

Static variables

@:value(0)staticread onlylength:Int = 0

Current number of BitmapData present in the pool.

@:value(8)staticmaxLength:Int = 8

Maximum number of BitmapData to hold in the pool.

Static methods


Disposes of all the BitmapData in the pool.

@:value({ exactSize : false, transparent : true })staticget(w:Int, h:Int, transparent:Bool = true, ?fillColor:FlxColor, exactSize:Bool = false):BitmapData

Returns a BitmapData with the specified parameters. If a suitable BitmapData cannot be found in the pool a new one will be created. If fillColor is specified the returned BitmapData will also be cleared with it.



If false a BitmapData with size >= [w, h] may be returned.


Adds bmd to the pool for future use.