# HELP ==\> load bitmap w/ smoothing

**URL:** <https://forum.kirupa.com/t/help-load-bitmap-w-smoothing/259466>\
**Category:** flash\
**Created:** [May 5, 2008, 7:26pm UTC](https://forum.kirupa.com/t/help-load-bitmap-w-smoothing/259466 "2008-05-05T19:26:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![schammy79](https://avatars.discourse-cdn.com/v4/letter/s/5fc32e/32.png) [@schammy79](https://forum.kirupa.com/u/schammy79)\
**Post date:** [May 5, 2008, 7:26pm UTC](https://forum.kirupa.com/t/help-load-bitmap-w-smoothing/259466/1 "2008-05-05T19:26:11Z")

</div>

I have this piece pof code to dynamically load bitmap with smoothing. One thing I want to change is **getNextHighestDepth()**… Because I have other elements in my swf, and I basically want the img to be the background.  
**[SIZE=3]What should I substitute it with?[/SIZE]** I tried to replace getNextHighestDepth() with an actual number but it doesn’t work or my swf turns all white, hiding all the other elements. Plus, I see that getNextHighestDepth() appears several times in the code and I don’t know whether I should change that too… I tried getDepth(), but without success. Maybe I write it down wrong…  
Please, Help!

```auto
import flash.display.*;
function loadBitmapSmoothed([url:String](http://www.kirupa.com/forum/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);
}
createEmptyMovieClip("myMC",2);    
loadBitmapSmoothed("[img.jpg",myMC);](http://www.marcsebastien.com/EN/photoGallery/img3.jpg",myMC);)

```
