Parent Preloader

This preloader loads another movie into a movieclip. The movieclip has a script shown below. Here the preloader bar is extended with _xscale and a background for the new movie is created with beginFill(). Download files.


Movieclip Script

We first load the movie and once it is loaded we then initiate to load a background picture. The rest of the code is to show the loading process.

stop();
//check the "preloader" MC for a script.
//we make the loaderbar at the beginning invisible,
//because it will show up before the movie is loaded.
_root.loaderBar._visible = false;

movieLoader.onEnterFrame = function() {
	this.loadMovie("advanced_search.swf");
    if(this._url != _root._url && !this._url.loaded) {		
        var kilobytes = Math.ceil(this.getBytesTotal()/1024);
        _root.frame = Math.ceil((this.getBytesLoaded()/this.getBytesTotal())*100);
		_root.loaderBar.gotoAndPlay (_root.frame);
		_root.frame = "loading " + _root.frame + "% of " + kilobytes + "kb";
		_root.loaderBar._visible = true;
	}
        if(this.getBytesLoaded() >= this.getBytesTotal()){
             this._url.loaded = true;			 
			 loadBackpic();
    }
}

function loadBackpic(){	
	backHolder.onEnterFrame = function() {
		backHolder.loadMovie("back.jpg");
    	if(backHolder._url != backHolder._url.loaded) {		
        	var kilobytes = Math.ceil(this.getBytesTotal()/1024);
        	_root.frame = Math.ceil((this.getBytesLoaded()/this.getBytesTotal())*100);
			_root.loaderBar.gotoAndPlay (_root.frame);
			_root.frame = "loading " + _root.frame + "% of " + kilobytes + "kb";
			_root.loaderBar._visible = true;
        	if(backHolder.getBytesLoaded() >= backHolder.getBytesTotal()){
             	backHolder._url.loaded = true;
				_root.gotoAndStop("start");
			}
		}
	}
}