public static function getBitmapData(target:DisplayObjectContainer) : BitmapData
{
var bounds : Rectangle = new Rectangle();
bounds = target.getBounds(target);
var matrix : Matrix = new Matrix(1, 0, 0, 1, 0 - bounds.x, 0 - bounds.y);
matrix.scale(1, 1);
//for png data set the transparent to true, otherwise just leave as false
var bmd : BitmapData = new BitmapData(bounds.width, bounds.height, true);
bmd.draw(target, matrix, null, null, null, true);
return bmd;
}