A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: [RESOLVED] Add Bitmap copy of DisplayObject to Canvas

  1. #1
    Join Date
    Mar 2004

    resolved [RESOLVED] Add Bitmap copy of DisplayObject to Canvas

    I'm trying to create a copy of a DisplayObject as a Bitmap and add the resulting Bitmap in to a Canvas object.

    Here is my code:
    *Note - value is the variable containing the DisplayObject
    var bitmap:Bitmap = new Bitmap();
    bitmap.bitmapData = new BitmapData(value.width, value.height, false, 0x000000);
    bitmap.bitmapData.draw( value, null, null, null, null );
    var image:Image = new Image();
    image.addChild( bitmap );
    image.width = this.width;
    image.height = this.height;
    The problem that I am encountering is that the Canvas I am adding the Image object to is displaying a blank area and does not contain the DisplayObject.

    Any help is greatly appreciated.

  2. #2
    Join Date
    Mar 2004
    Turns out the code that I had was correct. My issue was that I was using MXML to initiate the method containing the code in my post. This call was occurring prior to the value property being drawn by Flex.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width

HTML5 Development Center