AS2:
Ja sam svojevremeno na kirupa.com nasla jedno elegantno resenje za "jedan preloader-vise slika(swf-a)" i od tada ga koristim, manje-vise modifikovano.
bar._visible = false;
border._visible = false;
this.createEmptyMovieClip("container", "100");
my_mc = new MovieClipLoader();
preload = new Object();
my_mc.addListener(preload);
preload.onLoadStart = function(targetMC) {
trace("started loading "+targetMC);
container._visible = false;
bar._visible = true;
border._visible = true;
pText._visible = true;
};
preload.onLoadProgress = function(targetMC, lBytes, tBytes) {
bar._width = (lBytes/tBytes)*100;
pText.text = "% "+Math.round((lBytes/tBytes)*100);
};
preload.onLoadComplete = function(targetMC) {
container._visible = true;
border._visible = false;
bar._visible = false;
pText._visible = false;
trace(targetMC+" finished");
};
//default image (ili swf)
my_mc.loadClip("picture1.jpg", "container");
//buttons
button1.onPress = function() {
my_mc.loadClip("picture1.jpg", "container"); //ovde ide swf umesto jpg
};
button2.onPress = function() {
my_mc.loadClip("picture2.jpg", "container"); //swf umesto jpg
};
button3.onPress = function() {
my_mc.loadClip("picture3.jpg", "container"); //i ovde
};
Ceo tutorial je ovde:
http://www.kirupa.com/developer/actionscript/moviecliploader.htm
E, sad... ovo bi trebalo premunduriti ako radis u AS3.
|