I have some XML, that load in images, but the images are fairly large and there is a second or two when it is blank, and I’d like to add a preloader to play until the thing is loaded.
I’m clueless as to the correct syntax to use to do this.
Here is my code…
function loadBitmapSmoothed(url:String, target:MovieClip) {
// Create a movie clip which will contain our unsmoothed bitmap
var bmc:MovieClip = target.createEmptyMovieClip("bmc",target.getNextHighestDepth());
//mc1.setMask(_mask);
// 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;
_mask.frameTo(100, 0.6, "easeInOutCirc");
var bitmap:BitmapData = new BitmapData(mc._width, mc._height, true);
this.tmc.attachBitmap(bitmap, 1,"auto", true);
bitmap.draw(mc);
trace(mc);
trace(tmc + "this is what it is");
trace(target)
};
// Do it, load the bitmap now
var loader:MovieClipLoader = new MovieClipLoader();
loader.addListener(listener);
loader.loadClip(url, bmc);
}