# Resizing External Image

**URL:** https://forum.kirupa.com/t/resizing-external-image/281289
**Category:** flash
**Created:** [February 6, 2009, 10:37pm UTC](https://forum.kirupa.com/t/resizing-external-image/281289 "2009-02-06T22:37:44Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![j1234](https://avatars.discourse-cdn.com/v4/letter/j/f08c70/32.png) [@j1234](https://forum.kirupa.com/u/j1234)
#### Post date: [February 6, 2009, 10:37pm UTC](https://forum.kirupa.com/t/resizing-external-image/281289/1 "2009-02-06T22:37:44Z")

</div>

Hello community:

This code works. It puts my external image on the stage:

```auto
var pngurl:URLRequest=new URLRequest("image.png");
var pngloader:Loader=new Loader();
pngloader.load(pngurl);

this.addChild(pngloader);

```

This code works to, but not completely. It stores the same image inside of a movie clip that I’ve named “panel”. However, the image is \*\*bigger \*\*than “panel”:

```auto
var pngurl:URLRequest=new URLRequest("image.png");
var pngloader:Loader=new Loader();
pngloader.load(pngurl);

panel.addChild(pngloader); //panel is the name of my movieclip

```

I almost fixed my problem by changing my code. My image is\*\* smaller\*\* than “panel” now, but its width and height should be the same as “panel”:

```auto
var pngloader:Loader=new Loader();
pngloader.load(new URLRequest("image.png"));
pngloader.contentLoaderInfo.addEventListener(Event.COMPLETE, makeThumbs);

function makeThumbs(evt:Event):void {
	var tw:Number=panel.width;
	var th:Number=panel.height;
	var tbit:BitmapData=new BitmapData(tw,th);
	tbit.draw(evt.target.content);
	var thumb:Bitmap=new Bitmap(tbit);
	panel.addChild(thumb);
}

```

Does some one have experience with this. I’d appreciate any tips. (Original image size= 350width and 250height) (Panel size=100width and 100height)
