Hi,
I have some Actionscript for smoothing a dynamic image when it resizes and applying a mask to it. My idea is to have a slideshow that loads another random, masked, smoothed bitmap on top of this one (and animate the mask to create a transition, then unload the bottom bitmap). I would also really appreciate also it if the photos don’t repeat.
Can anyone help me make additions to this Actionscript for these functionalities? I’m having a devil of a time with this and I’m already late for my client.
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;
listener.onLoadStart = function() {
backgroundMC.createEmptyMovieClip("loadingBar", backgroundMC.getNextHighestDepth());
backgroundMC.loadingBar.drawRectangle(610, 3, 0xFFFFFF);
backgroundMC.loadingBar._x=7;
backgroundMC.loadingBar._y=404;
backgroundMC.loadingBar._xscale=.1;
}
listener.onLoadProgress = function(mc:MovieClip) {
var nPer:Number = Math.round((mc.getBytesLoaded()/mc.getBytesTotal())*100);
backgroundMC.loadingBar._xscale=nPer;
}
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);
}
listener.onLoadComplete = function(mc:MovieClip) {
var loading :Tween = new Tween(backgroundMC.loadingBar, "_alpha", Regular.easeInOut, 100, 0, 1, true);
backgroundMC.createEmptyMovieClip("maskMC", backgroundMC.getNextHighestDepth());
backgroundMC.maskMC._x=7;
backgroundMC.maskMC._y=140;
backgroundMC.maskMC.drawRectangle(610, 268, 0x000000);
backgroundMC.maskMC._yscale=0;
target.setMask(backgroundMC.maskMC)
var masker :Tween = new Tween(backgroundMC.maskMC, "_yscale", Regular.easeInOut, 0, 100, 1, true);
}
var loader:MovieClipLoader = new MovieClipLoader();
loader.addListener(listener);
loader.loadClip(url, bmc);
}
pic_arr = ["images/slideshow1.jpg", "images/slideshow2.jpg", "images/slideshow3.jpg", "images/slideshow4.jpg", "images/slideshow5.jpg"];
ranNum = Math.floor(Math.random()*pic_arr.length);
loadBitmapSmoothed(pic_arr[ranNum], backgroundMC.photoBox);
[COLOR=“Red”]If you’d like to see the .fla, it can be downloaded here. THANK YOU[/COLOR]