Frame progress bar

Just a lil thing i made for a project i am working on, figured there may be other people who want some easy to steal code for this instead of trying to figure it out from scratch.

Just put it in an empty layer that is the full length of your animation:


barHeight = 10;
barColor = 0x00ff00;
barAlpha = 100;
barWidth = Stage.width;
barLocation = "bottom";
//"top" or "bottom"
frameColor = 0x000000;
frameAlpha = 100;
///////////////////////////////
createEmptyMovieClip("bar", this.getNextHighestDepth());
with (bar) {
    beginFill(barColor, barAlpha);
    moveTo(0, 0);
    lineTo(barWidth, 0);
    lineTo(barWidth, barHeight);
    lineTo(0, barHeight);
    lineTo(0, 0);
    endFill();
}
createEmptyMovieClip("frame", this.getNextHighestDepth());
with (frame) {
    beginFill(frameColor, 0);
    lineStyle(1, frameColor, frameAlpha, true, "none", "none", "miter", 0.8);
    moveTo(0, 0);
    lineTo(barWidth-1, 0);
    lineTo(barWidth-1, barHeight);
    lineTo(0, barHeight);
    lineTo(0, 0);
    endFill();
}
bar._x = frame._x=0;
if (barLocation == "bottom") {
    bar._y = frame._y=Stage.height-frame._height;
} else if (barLocation == "top") {
    bar._y = frame._y=0;
} else {
    trace("please use either 'top' or 'bottom' for the barLocation");
}
var piece = Math.round(bar._width/100);
var barwidth = bar._width;
progress();
function progress() {
    onEnterFrame = function () {
        var percent = Math.round((_currentframe/_totalframes)*100);
        bar._width = piece*percent;
    };
}
frame.onPress = function() {
    delete _root.onEnterFrame;
    onEnterFrame = function () {
        bar._width = _xmouse;
        var percentage = Math.round((_xmouse/barwidth)*100);
        var percentageofframes = Math.round((_totalframes/100)*percentage);
        gotoAndStop(percentageofframes);
    };
};
frame.onRelease = function() {
    progress();
    play();
};
frame.onReleaseOutside = function() {
    progress();
    play();
};


Here’s a demo with the above variables(1.8mb):
http://www.joshuajonah.com/portfolio/progress.swf

Pretty basic, if you have any issues or questions feel free to post them here.