# \[F8\] Can't get "loadBitmapSmoothed" to work with my custom slideshow

**URL:** <https://forum.kirupa.com/t/f8-cant-get-loadbitmapsmoothed-to-work-with-my-custom-slideshow/282490>\
**Category:** flash\
**Created:** [February 22, 2009, 10:11pm UTC](https://forum.kirupa.com/t/f8-cant-get-loadbitmapsmoothed-to-work-with-my-custom-slideshow/282490 "2009-02-22T22:11:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![PCGamre](https://avatars.discourse-cdn.com/v4/letter/p/ea666f/32.png) [@PCGamre](https://forum.kirupa.com/u/PCGamre)\
**Post date:** [February 22, 2009, 10:11pm UTC](https://forum.kirupa.com/t/f8-cant-get-loadbitmapsmoothed-to-work-with-my-custom-slideshow/282490/1 "2009-02-22T22:11:53Z")

</div>

Simple concept, but I must be missing something.

**HERE’S THE SETUP:**

\*\*1) \*\*I create 2 empty MCs:  
var container = s1HLD.createEmptyMovieClip(“HLD1”,2);  
var container = s1HLD.createEmptyMovieClip(“HLD0”,1);

\*\*2) \*\*then I use code from: [http://www.kaourantin.net/2005/12/dynamically-loading-bitmaps-with.html](http://www.kaourantin.net/2005/12/dynamically-loading-bitmaps-with.html)

for bitmap smoothing b/c Flash 8 developers where payed more than they deserved :sigh: :

[AS]  
import flash.display.\*;

function loadBitmapSmoothed(url:String, target:MovieClip) {  
// 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;

    var bitmap:BitmapData = 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]

\*\*3) \*\*Lastly, I have a simple function that loads the image into the container MC.

[AS]  
function firstImage() {  
loadBitmapSmoothed(\_root.middle[0],container);

}  
[/AS]

**HERE’S THE PROBLEM:**  
The function works well if, instead of my target MC being the var “container”, it’s “s1HLD.HLD0.” However (of course), I need to use the var “container” b/c container is truly sometimes s1HLD.HLD[COLOR=Red]0[/COLOR], but other times it’s s1HLD.HLD[COLOR=Red]1[COLOR=Black] (depending on another var). It should work EITHER WAY!!! Right???

I know this can’t be all that difficult, but I haven’t been able to find a workaround.

Any help would be appreciated.[/COLOR][/COLOR]
