Random slideshow, URL problem

I’ve been working on this great slideshow from NoPonies and wanted to add a url link called from the xml to each images. I’m very close i’m sure but can anyone help me it’s driving me crazy for two days now…

here’s the as and the files are attached:

import flash.display.BitmapData;
import mx.utils.Delegate;
import gs.TweenLite;

class simpleSlideCaptions extends MovieClip {
//vars for XML
private var slideImage:XML;
public var bgImages:Array;
public var captionsArray:Array;
private var p:Number = 0;//track pos in arrays
//Variables pulled in from XML
private var crossFadeTime:Number;
private var imageTime:Number;
private var order:String;
private var captions:Boolean;
private var persistentCaptions:Boolean;
//empty mcs
public var holder_mc:MovieClip;
//set interval
private var bitmapFadeInterval:Number=0
//movieClip Loader
private var slideLoader:MovieClipLoader;
//textField Holder MC
private var captionsHolder:MovieClip;
//textField
private var captionsText:TextField;
//url
private var link:String;
//XML loc
private var xmlData:String;
//random image tracker
private var randomImg:Number;
//text array tracker
private var textInc:Number = 0
/******************************************
TEXTFIELD SPECIFIC VARS
******************************************/
//textField Padding, left and right indent from edge of image
private var captionsPadding:Number = 75;
//textField BG Colour
private var textFieldBgColour:Number = 0x000000;
//textField Bg Alpha
private var textFieldBgAlpha:Number = 100;
//textField Colour
private var textColour:Number = 0xFFFFFF;
//textField Font
private var textFieldFont:String = “PF_Ronda_Seven_Bold”;//font, embedded in library, set to export for actionScript
//textField Text Size
private var textFieldFontSize:Number = 11;
//textField Use Embedded Fonts
private var textFieldUseEmbedded:Boolean = true;//use if using embedded fonts

//passed via constructor argument, is the location movieClip you want the slideshow to appear in
private var slideTarget_mc:MovieClip;

/*****************************************/

function simpleSlideCaptions(slideTargets:MovieClip, xmlData:String) {
    //grab a reference to the class instance for use in the XML parsing routine
    var thisObj:simpleSlideCaptions = this;
    slideTarget_mc = slideTargets;
    this.xmlData = xmlData;
    
    //movieClip loader  
    slideLoader = new MovieClipLoader();
    slideLoader.addListener(this);//give the scope of this class instance

    var slideImage:XML = new XML();
    slideImage.ignoreWhite = true;
    slideImage.onLoad = function(success:Boolean) {
        if (success) {
            thisObj.slideImage = this;
            //get vars from XML file
            thisObj.crossFadeTime = this.firstChild.attributes.crossFadeTime;
            thisObj.imageTime = this.firstChild.attributes.imageTime;
            thisObj.imageTime = (1000*60)*thisObj.imageTime;
            thisObj.order = String(this.firstChild.attributes.order);
            thisObj.captions = Boolean(parseInt(this.firstChild.attributes.captions));//cast as boolean
            thisObj.persistentCaptions = Boolean(parseInt(this.firstChild.attributes.persistentCaptions));//cast as boolean
            thisObj.p = 0;
            thisObj.bgImages = [];//reset the array var, should for some reason you want to load in a different set of images
            thisObj.captionsArray = [];
            var xmlNodes = this.firstChild;
            var largeImages = xmlNodes.childNodes.length;
            var i = 0;
            for (i=0; i<largeImages; i++) {
                thisObj.bgImages* = xmlNodes.childNodes*.childNodes[0].firstChild.nodeValue;
                if (thisObj.captions == 1) {
                    thisObj.captionsArray* = xmlNodes.childNodes*.childNodes[1].firstChild.nodeValue;
                }
                link* = xmlNodes.childNodes*.childNodes[2].firstChild.nodeValue;
            }
            //load random image when we successfully parse XML
            //note reference to class instance
            thisObj.init();
        } else {
            trace("Fatal Error - Loading slideshow images XML failed");
        }
    };
    //lets load the XML file
    slideImage.load(xmlData);
}
//second constructor function, here we create our empty mc, set up the movieClipLoaders and finally call the loadSlides function
private function init() {
    //we have xml content, so lets start the image loading.
    holder_mc = slideTarget_mc.createEmptyMovieClip("holder_mc", 1);
    holder_mc._x = 0;
    holder_mc._y = 0;
    //create the captions if we want them
    if (captions) {
        //create captions text text field, empty mc and background MC
        captionsHolder = holder_mc.createEmptyMovieClip("captionsHolder", 3);
        captionsHolder.createEmptyMovieClip("captionsHolderBg",1);
        //draw the bg mc's fill
        captionsHolder.captionsHolderBg.beginFill(textFieldBgColour,textFieldBgAlpha);//fill colour, and alpha value set here!
        captionsHolder.captionsHolderBg.moveTo(0,0);
        captionsHolder.captionsHolderBg.lineTo(10,0);
        captionsHolder.captionsHolderBg.lineTo(10,10);
        captionsHolder.captionsHolderBg.lineTo(0,10);
        captionsHolder.captionsHolderBg.lineTo(0,0);
        captionsHolder.captionsHolderBg.endFill();

        //create the captions text field
        captionsHolder.createTextField("captionsText",2,0,0,0,0);//all zeros, we set its width etc later.
        //text format
        var my_fmt:TextFormat = new TextFormat();
        my_fmt.font = textFieldFont;//font
        my_fmt.size = textFieldFontSize;//size
        my_fmt.color = textColour;//text colour
        my_fmt.align = "justify";
        //text field properties
        captionsHolder.captionsText.embedFonts = textFieldUseEmbedded;
        captionsHolder.captionsText.autoSize = "left";
        captionsHolder.captionsText.wordWrap = true;
        captionsHolder.captionsText.html = true;
        captionsHolder.captionsText.setNewTextFormat(my_fmt);

        //add mouse event listeners if we want captions and they are set to not be persistent
        //be aware that links in captions text will fail to work if you turn on the rollovers.
        if (!persistentCaptions) {
            //use delegate to scope functions
            this.holder_mc.onRollOver = Delegate.create(this, imageOverHandler);
            this.holder_mc.onRollOut = Delegate.create(this, imageOffHandler);
            this.holder_mc.onRelease = Delegate.create(this, imagePressHandler);

        }
        //set the captions to have a 0 alpha, tweened in later   
        captionsHolder._alpha = 0;
    }
    //load the slide   
    loadSlides();
}
//captions function. Loads, resizes and tweens in the captions text
private function imageOverHandler() {

    captionsHolder.captionsText._x = holder_mc._x+captionsPadding;//place text field, we only use x, as we adjust the parent mc's y value.
    captionsHolder.captionsText._width = holder_mc._width-(captionsPadding*2);//size text field with some padding
    captionsHolder.captionsText.htmlText = captionsArray[textInc];//populate text field
    captionsHolder.captionsHolderBg._width = holder_mc._width;//size bg clip
    captionsHolder.captionsHolderBg._height = captionsHolder.captionsText._height+5;//size bg clip with some padding
    captionsHolder._y = (holder_mc._y+holder_mc._height-captionsHolder.captionsHolderBg._height)-225;//bottom align text//adjust here if needed pos of text
    TweenLite.to(captionsHolder,1,{_alpha:100});

}
//captions removal function, tweens text to 0 alpha and removes its content.
private function imageOffHandler() {
    TweenLite.to(captionsHolder,1,{_alpha:0, onComplete:emptyText, onCompleteParams:[this]});
    function emptyText(ref) {
        ref.captionsHolder.captionsText.htmlText = "";
        ref.captionsHolder._y = 0;//reset y of captions
    }
}

private function imagePressHandler() {
    getURL(link[p], "_self");
}

private function onLoadProgress(target:MovieClip, bytesLoaded:Number, bytesTotal:Number):Void {
    //amountLoaded = Math.floor((bytesLoaded/bytesTotal)*100);//calulate a loading percentage!
    //do something with this data if you want
}
//run when we have image data

private function onLoadInit(target:MovieClip):Void {

/remove the captions text, if we have it enabled. Check to see if the cursor is on the image, if it is run this function.
means that we can have a situation where the captions are set to display on mouseOver, but the image swaps, leaving old captions
because the mouse has not moved off the image to retrigger the captions functions. We also just don’t want to call this function
all the time either, as we would have a situation where we have enabled mouseOver captions, but they would show up, even if the mouse
was not over the image
/
if (captions && persistentCaptions || captions && holder_mc.hitTest(_root._xmouse, _root._ymouse, true)) {
imageOffHandler();
}
//clear the existing interval
clearInterval(this.bitmapFadeInterval);
//alpha out our image we load our bitmap into
target._alpha = 0;
//create the bitmap object, each time this is reset, keeping memory footprint fairly low…
var bitmap:BitmapData = new BitmapData(target._width, target._height, true);
//draw the bitmap
bitmap.draw(target);
//fade in the temp mc
TweenLite.to(target,this.crossFadeTime,{_alpha:100, onComplete:onFinishTween, onCompleteParams:[this]});//pass reference to class
//as “this” refers to the tween object itself when called from the tween onComplete handler…
function onFinishTween(ref) {
//attach our loaded bitmap to our background mc when the temp totally obscures it
ref.holder_mc.attachBitmap(bitmap,0,“auto”,true);
//fade the temp back to 0
TweenLite.to(target,.1,{_alpha:0, onComplete:clearTween});
//tween in the captions text. See above description for rationale.
if (ref.captions && ref.persistentCaptions || ref.captions && ref.holder_mc.hitTest(_root._xmouse, _root._ymouse, true)) {
ref.imageOverHandler();
}
function clearTween() {
//remove the temp mc
removeMovieClip(ref.holder_mc.bg_loader);
}
//reset the timer
//increment manual click var
ref.beginInterval();
}

}
private function beginInterval():Void {
    this.bitmapFadeInterval = setInterval(this, "loadSlides", imageTime);
}

/Load the slides./

private function loadSlides() {
    if (order == "random") {
        //create the temp loader mc that we load our new image into
        holder_mc.createEmptyMovieClip("bg_loader",2);
        getUniqueNum();
    } else {
        //sequential loading of images
        holder_mc.createEmptyMovieClip("bg_loader",2);
        slideLoader.loadClip(bgImages[p],holder_mc.bg_loader);
        textInc = p
        p++;
        if (p == bgImages.length) {
            p = 0;
        }
        
    }
}
//generate a unique number, no immediate duplicates in random slide shows
private function getUniqueNum() {
    var tempRandomImg = Math.floor(Math.random(bgImages.length)*bgImages.length);
    if (tempRandomImg == randomImg &&bgImages.length>1 ) {
        getUniqueNum();
    } else {
        randomImg = p = textInc = tempRandomImg;
        slideLoader.loadClip(bgImages[randomImg],holder_mc.bg_loader);
    }
}
//kill the interval functions
public function killInterval() {
    clearInterval(bitmapFadeInterval);
    bitmapFadeInterval = null
}

}

Thanks in advance.

anyone ?