Custom percentage preloader

Also maybe you might be able to answer this too.

I am trying to make a custom percentage preloader.
I have a timeline (by timeline I am not refering to my movie timeline, I am referring to an actual timeline, 1767, 1800, 1820…2004) that calls separtare .swf files for each year.

I would like the preloader to show the current year your on and add or subtract up to the “current” year you click on. (e.g. If your at 1767 and you click on 1900, the loader will the count from 1767 to 1900.

I have this started (pseudo) It is jumbled, and needs work…

// Figures out the percentage gap from 2 set variables
if (currentYear < targetYear) {
percentage = targetYear - currentYear;
} else {
percentage = currentYear - targetYear;
}
//preloader syntax
bytes_loaded = Math.round(this.getBytesLoaded());
bytes_total = Math.round(this.getBytesTotal());
getPercent = bytes_loaded/bytes_total;

if (bytes_loaded == bytes_total) {
_root.gotoAndPlay(25);
}

The script is not finished, half-functional at best!

So basically I am trying to pull 2 sets of variables (currentYear and targetYear). The current year variable represents the year the user is on, the target year variable represents the year the user goes to. My if statement above is to figure out if the current year is smaller than the target year, because then the preloader would have to count down (1820 to 1767).

It’s too complex for me right now, I am just not well-versed in actionscript.

Any thoughts?