Hi People
I want want to create a gallery where the images fill up the entire Browser window.
Here is what I got so far
Stage.scaleMode = "noScale";
Stage.align = "TL";
import flash.display.*;
stop();
var sl:Object = new Object();
sl.onResize = function() {
preloader._width = Stage.width;
preloader._height = 2;
preloader._x = 0;
preloader._y = 0;
};
sl.onResize();
preloader.bar._xscale = 0;
function loadBitmapSmoothed(imageURL: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);
loadProgress = bytesLoaded/bytesTotal*Stage.width;
preloader.bar._width = Math.round(loadProgress);
mcPer._x = loadProgress-2;
mcPer._y = 5;
mcPer.txtPer.text = percent;
preloader.bar._xscale = percent;
if (bytesLoaded == bytesTotal) {
}
};
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);
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(imageURL,bmc);
}
loadBitmapSmoothed("myimage.jpg", bg_con)
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);
How can I use an XML file to get the images from?
Thanks in advance
Crasher