AS3 Random Array Problem

I’m a flash noob and I’m having trouble randomizing few dynamically loaded swf files.

  1. I have a UILoader on the stage with an instance name of bg_ldr. It is working properly.

  2. I have (attempted) to set up a function called getRandomNumber (see code below) and I believe it is correct.

  3. BUT… specifically I don’t know what I should put in this part of the code: bg_ldr.source = bgArray[???]; and I think this area is the problem. I thought I could just call my function, like this:

bg_ldr.source = bgArray[getRandomNumber];

But it’s not working. Any help you could give would be very much appreciated, and thanks in advance for your trouble!

var bgArray:Array = ["TheWhimbrel.swf", "DesertSun.swf", "DohaCityScape2.swf", "DohaNights.swf", "FindingTheWay.swf", "JourneyOfFive.swf", "PaleolithicDoha.swf", "Sandstorm.swf","SedimentalSouls.swf","TheLeader.swf","CranesOfLight.swf"];
var loadimage:String = bgArray[getRandomNumber(0,bgArray.length - 1)];

function getRandomNumber(min:Number, max:Number):Number
{
	var randomNumber:Number = Math.round(Math.random() * (max - min) + min);
	return randomNumber;
}

bg_ldr.source = bgArray[getRandomNumber];