# Loading external bitmap textures

**URL:** <https://forum.kirupa.com/t/loading-external-bitmap-textures/249384>\
**Category:** flash\
**Created:** [January 18, 2008, 5:09am UTC](https://forum.kirupa.com/t/loading-external-bitmap-textures/249384 "2008-01-18T05:09:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![gregmax](https://avatars.discourse-cdn.com/v4/letter/g/ac8455/32.png) [@gregmax](https://forum.kirupa.com/u/gregmax)\
**Post date:** [January 18, 2008, 5:09am UTC](https://forum.kirupa.com/t/loading-external-bitmap-textures/249384/1 "2008-01-18T05:09:06Z")

</div>

just like the title says… is it possible? I have found this online but it doesn’t seem to be working as planned ☹ it does place the image on stage, but what I want to use it as a texture.

[AS]

```
public function loadTexture(url:String, target:MovieClip) {
	
	var bitmap:BitmapData;
	
	// Create a movie clip which will contain our 
	// unsmoothed bitmap
	var bmc:MovieClip = target.createEmptyMovieClip("bmc",target.getNextHighestDepth());
	
	// Create a listener which will notify us when 
	// the bitmap loaded successfully
	var listener:Object = new Object();

	// Track the target
	listener.tmc = target;
 
	// If the bitmap loaded successfully we redraw the 
	// movie into a BitmapData object and then attach 
	// that BitmapData to the target movie clip with 
	// the smoothing flag turned on.
	listener.onLoadInit = function(mc:MovieClip) {
		
		mc._visible = false;
		bitmap = new BitmapData(mc._width, mc._height, true);
		this.tmc.attachBitmap(bitmap, this.tmc.getNextHighestDepth(), "auto", true);
		bitmap.draw(mc);
		
	};
 
	// Do it, load the bitmap now
	var loader:MovieClipLoader = new MovieClipLoader();
	loader.addListener(listener);
	loader.loadClip(url, bmc);
	
}

```

[/AS]

What am I doing wrong?
