hello guys,
I need some help with a fullscreen gallery and the bitmap smoothing thing. I tried to combine the gallery code and the bitmap code I found in this thread. Well, it’s a xml based fullscreen gallery and it works fine but without smoothing :cry3:. okay, i hope anybody can help - here is an extract of the gallery code:
imageNum++;
imageHolder_mc.createEmptyMovieClip("image"+imageNum+"_mc", imageNum);
eval("imageHolder_mc.image"+imageNum+"_mc")._alpha = 0;
eval("imageHolder_mc.image"+imageNum+"_mc").loadMovie("images/"+galleryMenuArray[thisImgNum][1]);
onEnterFrame = function(){
if(eval("imageHolder_mc.image"+imageNum+"_mc")._width > 0){
cover_mc.removeMovieClip();
preloader_mc.removeMovieClip();
delete onEnterFrame;
tweenAlphaOut(eval("imageHolder_mc.image"+lastImageNum+"_mc"));
resizeImage(eval("imageHolder_mc.image"+imageNum+"_mc"));
tweenAlpha(eval("imageHolder_mc.image"+imageNum+"_mc"), 100);
lastImageNum = imageNum;
};
};
};
and this is the code I tried to combine with:
import flash.display.*;
function loadBitmapSmoothed(url:String, target:MovieClip) {
var bmc:MovieClip = target.createEmptyMovieClip(
"bmc",
target.getNextHighestDepth()
);
var listener:Object = new Object();
listener.tmc = target;
listener.onLoadProgress = function(target:MovieClip, bytesLoaded:Number, bytesTotal:Number):Void {
percent = Math.round((bytesLoaded/bytesTotal)*100);
pText.text = percent+"%";
}
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);
// set size and position on load
if(Stage.height/Stage.width > target._height/target._width) {
img_prop = target._width/target._height;
target._height = Stage.height;
target._width = Stage.height*img_prop;
target._y = (Stage.height/2)-(target._height/2);
target._x = (Stage.width/2)-(target._width/2);
} else {
img_prop = target._height/target._width;
target._width = Stage.width;
target._height = Stage.width*img_prop;
target._y = (Stage.height/2)-(target._height/2);
target._x = (Stage.width/2)-(target._width/2);
}
};
var loader:MovieClipLoader = new MovieClipLoader();
loader.addListener(listener);
loader.loadClip(url, bmc);
}
_root.createEmptyMovieClip("bg_con", 0);
loadBitmapSmoothed("bg.jpg", bg_con);
// set size and position on resize
var stage_listener:Object = new Object();
stage_listener.onResize = function():Void {
if(Stage.height/Stage.width > bg_con._height/bg_con._width) {
img_prop = bg_con._width/bg_con._height;
bg_con._height = Stage.height;
bg_con._width = Stage.height*img_prop;
bg_con._y = (Stage.height/2)-(bg_con._height/2);
bg_con._x = (Stage.width/2)-(bg_con._width/2);
} else {
img_prop = bg_con._height/bg_con._width;
bg_con._width = Stage.width;
bg_con._height = Stage.width*img_prop;
bg_con._y = (Stage.height/2)-(bg_con._height/2);
bg_con._x = (Stage.width/2)-(bg_con._width/2);
}
}
Stage.addListener(stage_listener);
thank you very much for any help.