Loaders and Arrays and Loaders and Arrays

I have an idea on how to execute this, but I can’t seem to put it into code. That ever happen to anyone? I’m probably the only one.

Anyway. I’ve got a mc on the stage. I have a loader that will load an image into said mc. No problem. But what if I want it to load images randomly upon refreshing the page? My idea is to create an array that contains my URLRequests, then add a child from that. I just can’t quite put it into code.

Code so far. The commented parts are what I’m thinking I need to include …


package {
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.net.navigateToURL;
    import flash.net.URLRequest;
    import flash.display.Loader;

    public class Loader extends Sprite {
        private var loader:Loader=new Loader;
        private var url:URLRequest = new URLRequest("x.jpg");
        //private var loadArray:Array = new Array ["x.jpg","y.jpg","z.jpg"] But how do I get y and z into the display list? Create two more URLRequest variables?
        //private var imageLoader:URLLoader=new URLLoader;

        public function Loader() {
            content_mc.addEventListener(Event.ENTER_FRAME, loadPics);
            //imageLoader.addEventListener(Event.COMPLETE, imagesLoaded);

        }
        public function loadPics(e:Event):void {
            loader.mask = content_mc;
            loader.load(url);
            trace("load complete");
            addChildAt(loader, 1);
            loader.x = 0;
            loader.y = 0;
        }
        /*public function imagesLoaded(e:Event): void {
            for (var i: uint=0; i < loadArray; i++) {
                addChild(url);
            }
        }*/

Could someone point me in the right direction?
Thanks for any help. Please feel free to tell me I’m an idiot, too.