rustyofco
07-02-2008, 08:57 PM
First I set up a bitmapdata object:
var bd:BitmapData = new BitmapData(500,500,true,0x00000000);
var bmp:Bitmap = new Bitmap(bd);
stage.addChild(bmp);
then, occasionally I will draw stuff in that bd object. So it's all good.
(I'm drawing things using the functions from this class:
http://www.bytearray.org/?p=67)
That code draws stuff into the bd object.
But once in a while I want to erase everything I drew, making a new bd object.
So I try this code... but it doesn't work:
function clearbd(){
var bd:BitmapData = new BitmapData(500,500,true,0x00000000);
contbg2.removeChild(bmp);
var bmp:Bitmap = new Bitmap(bd);
contbg2.addChild(bmp);
}
Basically, I redefine bd and bmp to new, blank BitmapData and Bitmap objects... But this doesn't work...
var bd:BitmapData = new BitmapData(500,500,true,0x00000000);
var bmp:Bitmap = new Bitmap(bd);
stage.addChild(bmp);
then, occasionally I will draw stuff in that bd object. So it's all good.
(I'm drawing things using the functions from this class:
http://www.bytearray.org/?p=67)
That code draws stuff into the bd object.
But once in a while I want to erase everything I drew, making a new bd object.
So I try this code... but it doesn't work:
function clearbd(){
var bd:BitmapData = new BitmapData(500,500,true,0x00000000);
contbg2.removeChild(bmp);
var bmp:Bitmap = new Bitmap(bd);
contbg2.addChild(bmp);
}
Basically, I redefine bd and bmp to new, blank BitmapData and Bitmap objects... But this doesn't work...