Preloader in Code

Matrix style… I’m reposting this because I’m not sure anyone will check the other post. I hope noone minds - here goes:

Originally posted by Sinfinity: Leave two blank frames in front of the first frame of your movie and paste this into the actions of the second.

Here is code that allows you to specify the shape and size of a loading progress bar (it’s always a rectangle). just specify the upper left corner and the lower right corner and you have a progress bar for any size stage.

// here is the order of the array…
// upper left _x, upper left _y, lower right _x, lower right _y
this.aCorners = [5,10,545,20];
if (!zInit) {
createEmptyMovieClip(“mcBorders”, 2);
createEmptyMovieClip(“mcProgress”, 1);
mcBorders.lineStyle(0, 0x0000ff, 100);
mcBorders.moveTo(this.aCorners[0], this.aCorners[1]);
mcBorders.lineTo(this.aCorners[0], this.aCorners[3]);
mcBorders.moveTo(this.aCorners[2], this.aCorners[1]);
mcBorders.lineTo(this.aCorners[2], this.aCorners[3]);
mcBorders.zInit = true;
}
_root.nPercentLoaded = (_root.getBytesLoaded()/_root.getBytesTotal())100;
mcProgress.beginFill(0xff0000,100);
mcProgress.moveTo(this.aCorners[0], this.aCorners[1]);
mcProgress.lineTo((nPercentLoaded
((this.aCorners[2]-this.aCorners[0])/100))+this.aCorners[0], this.aCorners[1]);
mcProgress.lineTo((nPercentLoaded*((this.aCorners[2]-this.aCorners[0])/100))+this.aCorners[0], this.aCorners[3]);
mcProgress.lineTo(this.aCorners[0], this.aCorners[3]);
mcProgress.endFill();
if (_root.nPercentLoaded<100) {
gotoAndPlay(_currentframe-1);
} else {
removeMovieClip(_root.mcBorders);
removeMovieClip(_root.mcProgress);
}

Pretty isn’t it?

It has two little lines either end - what I’d like to know is how to put lines above and below it so that it loads in a rectangle. I’ve given it a go but my 'script just wasn’t up to it.

I’ve already changed the colour and position but if it loaded in a proper box (and perhaps had ‘Loading…’ written above it - it would surely be the tightest little Preloader that ever there was…?