G'Day Edward,

Heres my code for a preloader. I use the movieClipLoader for good call backs and now onEnterFrame functions (sooo flash 5 ;))

var mcl:MovieClipLoader = new MovieClipLoader();
var loadingListener:Object = new Object();

mcl.addListener(loadingListener);

var target_mc = this.createEmptyMovieClip(loadClipInstance, loadClipDepth);

loadingListener.onLoadStart = function(target:MovieClip) {
   // starting load
};

loadingListener.onLoadProgress = function(target:MovieClip, loadedBytes:Number, totalBytes:Number) {
   progressBar._xscale = (loadedBytes/totalBytes)*100;
};

loadingListener.onLoadInit = function(target:MovieClip) {
   // stuff is loaded
};

mcl.loadClip(loadClipPath, target_mc);



you can only test preloaders on a live website.. testing locally or within flash will not work, so upload your stuff to a server and test it out.

cheers

andy


So you guys tell me that a single frame, single file site with a preloader 100% dynamic is pretty much impossible, ok i accept that. here is my external preloader, any ideas ... site loads, no progress appearance at all.
// begin code
// -------------------------
// text formats section
var format1_fmt:TextFormat = new TextFormat();
with (format1_fmt) {
color = 0xFFFFFF;
font = "swfitslim99";
size = 8;
};
// -------------------------
function preloader() {
// create movieclip to load swf in
_root.createEmptyMovieClip("target_mc", this.getNextHighestDepth() );
_root.target_mc.loadMovie("site.swf");
// draw preloader
_root.createEmptyMovieClip("preloader_mc", _root.getNextHighestDepth() );
_root.preloader_mc.createTextField("preloader_txt", _root.getNextHighestDepth, 
0, 0, 200, 20);
with (_root.preloader_mc.preloader_txt) {
 embedFonts = true;
 selectable = false;
 setNewTextFormat(format1_fmt);
 text = "LOADING SITE: 00"
};
_root.preloader_mc._x = (Stage.width/2) - 
(_root.preloader_mc.preloader_txt._width/2);
_root.preloader_mc._y = (Stage.height/2) - 
(_root.preloader_mc.preloader_txt._height/2);
// ---------
// preload _root.onEnterFrame = function() {
 tBytes = _root.target_mc.getBytesTotal();
 bLoaded = _root.target_mc.getBytesLoaded();
 percent = Math.round((bLoaded/tBytes)*100);
 if (bLoaded < tBytes) {
  _root.preloader_mc.preloader_txt.text = "loading site: " + percent;
 } else {
  trace("completed loading!");
  _root.preloader_mc.removeMovieClip();
  _root.preloader_mc.preloader_txt.removeTextField();
  delete this.onEnterFrame;
 };
};
};
// -------------------------
preloader();
// -------------------------

// http://www.murderdesign.com/preloader.swf
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com



_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to