jibble
June 30, 2008, 6:11pm
1
check this out and let me know if it loads fast/slow or if you can get it to mess up. I know the initial screen is blank except for the buttons. Ideally the load will be little to nothing, a quick flash.
[SIZE=7]LINK[/SIZE]
-edit-
maybe i should explain a bit better. Its a full screen image test and im trying to see if it’s loading good/bad to others. Each image is ~80-100k
not sure you’re in the correct forum…
it was fast
seems fairly quick, the 3rd image took a little longer
if this is an actual project, you might want to store the images as a BitmapData object after they’ve loaded once, so you dont need to reload them and see the preloader again, even though it’s just a glimpse, it’s not very attractive
ooOOOoo! good idea nathan. Any idea how i go about that? The current code is a bit different at this point.
Here it is…
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+"%";
}
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/bg4.jpg", bg_con);
btn1.onRelease = function(){
loadBitmapSmoothed("images/bg4.jpg", bg_con);
}
btn2.onRelease = function(){
loadBitmapSmoothed("images/bg5.jpg", bg_con);
}
btn3.onRelease = function(){
loadBitmapSmoothed("images/bg3.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);
3-7 seconds load time on each image.
1-2 seconds before the preloader appeared, another 2-5 seconds before the image appeared. (after fading to complete white)