# Loading an image into a MovieClip, then into BitmapData \[renamed\]

**URL:** <https://forum.kirupa.com/t/loading-an-image-into-a-movieclip-then-into-bitmapdata-renamed/206280>\
**Category:** flash\
**Created:** [November 6, 2006, 8:13pm UTC](https://forum.kirupa.com/t/loading-an-image-into-a-movieclip-then-into-bitmapdata-renamed/206280 "2006-11-06T20:13:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![wadester](https://avatars.discourse-cdn.com/v4/letter/w/9dc877/32.png) [@wadester](https://forum.kirupa.com/u/wadester)\
**Post date:** [November 6, 2006, 8:13pm UTC](https://forum.kirupa.com/t/loading-an-image-into-a-movieclip-then-into-bitmapdata-renamed/206280/1 "2006-11-06T20:13:05Z")

</div>

Hello,

I am trying to load an image into a movieclip and then draw the contents of the movieclip to a bitmapData object. Below is some sample code.

```auto
target.jpg_mc.loadMovie(url);
 target.createEmptyMovieClip("loader_mc", 100);
 target.loader_mc.bmc = target.jpg_mc; // movieclip where to load original image
 target.loader_mc.tmc = target.bmp_mc; // movieclip with smoothed image
 target.loader_mc.onEnterFrame = function(){
 
  bl = this.bmc.getBytesLoaded();
  bt = this.bmc.getBytesTotal();
  if (bl >= bt && bt > 4 && this.bmc._width > 0 && this.bmc._height > 0){
   //target._parent._visible = true;
 
   this.bmc._visible = false;
 
   var bitmap = new BitmapData(this.bmc._width, this.bmc._height, true);
   this.tmc.attachBitmap(bitmap, 100,"auto", true);
   bitmap.draw(this.bmc);
 
   Stage.addListener(target);
 
   target.gotoAndPlay("in");
   this.removeMovieClip();
  }
 }

```

For some reason it always draws a white box rather than the image. Has anyone ever seen this happen with the bitmapData class?

Thanks for any help!

Wade
