degauss
03-11-2009, 05:45 PM
Hey all,
I'm trying to draw a copy of a Flex UI Component using the Bitmap and BitmapData classes. My problem is that when it draws the bitmap on the stage, all I get is a white box. I'm not sure why it isn't displaying the bitmap data of the component.
Here's my code. Any help is appreciated.
private var _target:UIComponent;
/**
* Sets the "target" parameter
*/
public function set target(value:UIComponent) {
_target = value;
_doCopy();
}
/**
* This function does the actual copy and displays it on the stage
*/
private function _doCopy():void {
var bmData:BitmapData = new BitmapData(
_target.width, _target.height, false
);
var rect:Rectangle = new Rectangle(25,25,_target.width,target.height);
bmData.draw(_target);
graphics.beginBitmapFill(bmData, new Matrix(), false);
graphics.drawRect(25, 25, _target.width, _target.height);
graphics.endFill();
}
I'm trying to draw a copy of a Flex UI Component using the Bitmap and BitmapData classes. My problem is that when it draws the bitmap on the stage, all I get is a white box. I'm not sure why it isn't displaying the bitmap data of the component.
Here's my code. Any help is appreciated.
private var _target:UIComponent;
/**
* Sets the "target" parameter
*/
public function set target(value:UIComponent) {
_target = value;
_doCopy();
}
/**
* This function does the actual copy and displays it on the stage
*/
private function _doCopy():void {
var bmData:BitmapData = new BitmapData(
_target.width, _target.height, false
);
var rect:Rectangle = new Rectangle(25,25,_target.width,target.height);
bmData.draw(_target);
graphics.beginBitmapFill(bmData, new Matrix(), false);
graphics.drawRect(25, 25, _target.width, _target.height);
graphics.endFill();
}