I’ve been playing with this full screen image idea, and for the most part ive got a really good working example.
The problem im running into here is i’d like to preload all those images (say 5) and have a simple navigation to view each of those images.
A good example of what im looking for is www.byhook.com
i found some code that works great(for one image) but i’d like to add images and buttons and load ALL of them BEFORE the first image shows up, then be able to navigate them
stop();
#include "mc_tween2.as"
Stage.scaleMode ="noScale";
Stage.align = "LT";
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+"%";
if (bytesLoaded >= bytesTotal) {
gotoAndStop(2);
}
}
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);
}
loadBitmapSmoothed("images/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);