Help! preloading a random background

I can’t tell you how long I’ve slaved over this question. I would ultimately like to load a random background, but first I’m just trying to preload a script-defined background. This is the coding I’m at right now and it doesn’t work at all; it just sits with an empty load bar and “NaN% loaded” as the text. Any help you guys could give me would be VERY MUCH appreciated. Thanks in advance!


Here’s the script–

//pic folder name
folder = “pics”;

//create Holder and place him
this.createEmptyMovieClip(“image”, 1);
image._x = 0;
image._y = 0;

//load the content
image.loadMovie(folder + “/background.jpg”);

//declare and launch preload
var content = image;

function loadNow(content) {
//Turn on and initialize the preloader
_root.loadBar._xscale = 0;
_root.loadText = “0% loaded”;
//Set an interval to update the loading progress
loadInterval = setInterval(checkProgress, 10, content);

function checkProgress(content) {
//Set all variables to default
var contentSize = 0;
var downloaded = 0;
var percntLoaded = 0;
//Get total and loaded bytes
contentSize = content.getBytesTotal();
downloaded = content.getBytesLoaded();
percentLoaded = Math.ceil(downloaded / contentSize * 100);

//Update the preloader display
_root.loadText = percentLoaded + "% loaded";
_root.loadBar._xscale = percentLoaded;

//Is everything loaded?
if (downloaded == contentSize && contentSize > 0) {