Randomizing CSS based on Array value

So I figured that the last idea I had would not work, but I realized that if I attached each seperate background image from an array to a css element that, that would indeed work.

The problem is I’m not sure how I can attach them. Any help would be appreciated.

Alright, so I figured it out… I just used a slight mod of kirupa’s tutorial and snehal’s addon tutorial…Hope it can help someone else out.


backgrounds = new Array("0.jpg", "1.jpg", "2.jpg", "3.jpg");
function randomBackground(){
	randomNumber = random (backgrounds.length);
	loadMovie (backgrounds[randomNumber], "_root.background");
}
randomBackground();
var format = new TextField.StyleSheet();
var path = "http://www.21bluefish.com/" + randomNumber + ".css";
format.load(path);
format.onLoad = function(loaded) {
	if (loaded) {
		output.styleSheet = format;
		myLoadVar = new LoadVars ();
		myLoadVar.load("kirupa.txt")
		myLoadVar.onLoad = function (success){
			if (success == true) {
				output.variable = "kirupa"
				output.htmlText=myLoadVar.kirupa;
				}
			}

	} else {
		output.text = "Error loading CSS file!";
	}
};