XML Slide show Script

I wrote the below script but i can not giving link to images,

**here is action script

import mx.transitions.Tween;
import mx.transitions.easing.;
var flag:Boolean = true;
var container:MovieClip = this.createEmptyMovieClip(“container”, 0);
container._x = 0;
container._y = 0;
var container1:MovieClip = container.createEmptyMovieClip(“container1”, 2);
var container2:MovieClip = container.createEmptyMovieClip(“container2”, 1);
var ImageIndexClip0:MovieClip = this.createEmptyMovieClip(“ImageIndexClip”, 3);
var ImageIndexClip1:MovieClip = this.createEmptyMovieClip(“ImageIndexClip”, 4);
var ImageIndexClip2:MovieClip = this.createEmptyMovieClip(“ImageIndexClip”, 5);
var ImageIndexClip3:MovieClip = this.createEmptyMovieClip(“ImageIndexClip”, 6);
var ImagePlayClip:MovieClip = this.createEmptyMovieClip(“ImagePlayClip”, 7);
this.createEmptyMovieClip(“watcher_mc”, 100);
var picArray:Array = new Array();
var picIDArray:Array = new Array();
var picTotal:Number;
var i:Number = 2;
var j:Number = 0;
var x:Number = 0;
var k:Number = 0;
var m:Number;
var n:Number = 3;
var p:Number = 0;
var btn_no:Number = 0;
var delay;
var flag1:Boolean;
my_xml = new XML();
my_xml.ignoreWhite = true;
my_xml.onLoad = function(success) {
if (success) {
picTotal = this.firstChild.childNodes.length;
for (var i = 0; i<this.firstChild.childNodes.length; i++) {
picArray
= this.firstChild.childNodes
.attributes.pic;
picIDArray
= this.firstChild.childNodes*.attributes.txt;
}
} else {
trace(“Error in loding”);
}
loadImage();
};
my_xml.load(“main.xml”);
function loadImage() {
if (delay) {
clearInterval(delay);
}
if (flag == true) {
if (i == 2) {
thisLoader = container.container2;
thisLoader.loadMovie(picArray[j]);
_root.img_no.text = picIDArray[j];
}
if (i == 1) {
thisLoader = container.container1;
thisLoader.loadMovie(picArray[j]);
_root.img_no.text = picIDArray[j];
}
}

ImagePlayClip._x = 595;
ImagePlayClip._y = 8;
//***********************************************
ImageIndexClip0.attachMovie("imageIndex", "imageIndex0", _root.getNextHighestDepth()+1);
ImageIndexClip1.attachMovie("imageIndex", "imageIndex1", _root.getNextHighestDepth()+2);
ImageIndexClip2.attachMovie("imageIndex", "imageIndex2", _root.getNextHighestDepth()+3);

//***********************************************
ImageIndexClip0.imageIndex0._x = 766;
ImageIndexClip0.imageIndex0._y = 53;
ImageIndexClip1.imageIndex1._x = 790;
ImageIndexClip1.imageIndex1._y = 53;
ImageIndexClip2.imageIndex2._x = 814;
ImageIndexClip2.imageIndex2._y = 53;
//************************************************
ImagePlayClip.attachMovie("playClip", "playClip0", _root.getNextHighestDepth()+5);
//ImagePlayClip.playClip0.img_status.text = "Stop";
if (flag == true) {
    ImagePlayClip.playClip0.attachMovie("stop_mc", "stop_mc1", 1000);
    ImagePlayClip.playClip0.play_mc1.removeMovieClip();
} else {
    ImagePlayClip.playClip0.attachMovie("play_mc", "play_mc1", 1000);
    ImagePlayClip.playClip0.stop_mc1.removeMovieClip();
}
//*******if u comment then next and previous button shows always***********
btn_no = k+0;
ImageIndexClip0.imageIndex0.imageIndex_txt.text = btn_no+1;
if ((k+1)&gt;picTotal-1) {
    ImageIndexClip1.imageIndex1.imageIndex_txt.text = "";
    ImageIndexClip1.imageIndex1._visible = 0;
} else {
    btn_no = k+1;
    ImageIndexClip1.imageIndex1.imageIndex_txt.text = btn_no+1;
}
if ((k+2)&gt;picTotal-1) {
    ImageIndexClip2.imageIndex2.imageIndex_txt.text = "";
    ImageIndexClip2.imageIndex2._visible = 0;
} else {
    btn_no = k+2;
    ImageIndexClip2.imageIndex2.imageIndex_txt.text = btn_no+1;
}
if ((k+3)&gt;picTotal-1) {
    ImageIndexClip3.imageIndex3.imageIndex_txt.text = "";
    ImageIndexClip3.imageIndex3._visible = 0;
} else {
    btn_no = k+3;
    ImageIndexClip3.imageIndex3.imageIndex_txt.text = btn_no+1;
}

if (j&lt;3) {
    r = j;
} else {
    r = (j%3);
}
if (r == 0) {
    ImageIndexClip0.imageIndex0.imageIndex_txt.background = true;
    ImageIndexClip0.imageIndex0.imageIndex_txt.backgroundColor = 0x919090;
}
if (r == 1) {
    ImageIndexClip1.imageIndex1.imageIndex_txt.background = true;
    ImageIndexClip1.imageIndex1.imageIndex_txt.backgroundColor = 0x919090;

}
if (r == 2) {
    ImageIndexClip2.imageIndex2.imageIndex_txt.background = true;
    ImageIndexClip2.imageIndex2.imageIndex_txt.backgroundColor = 0x919090;
    
}

watcher_mc.onEnterFrame = function() {
    var picLoaded = thisLoader.getBytesLoaded();
    var picBytes = thisLoader.getBytesTotal();
    if (isNaN(picBytes) || picBytes&lt;4) {
        return;
    }
    if (picLoaded/picBytes&gt;=1) {
        swapPlace(container.container2);
        if (flag == true) {
            delay = setInterval(loadImage, 4000);
        }
        alphaTween = new mx.transitions.Tween(thisLoader, "_alpha", mx.transitions.easing.Regular.easeOut, 0, 100, 1, true);
        delete this.onEnterFrame;
        _root.j += 1;
        if (n%2 == 1) {
            i = 1;
        } else {
            i = 2;
        }
        n++;
    }
    if (_root.j&gt;=picTotal) {
        _root.j = 0;
        _root.k = 0;
    }
};
_root.m = j;

}
function swapPlace(clip:MovieClip) {
clip.swapDepths(container.container1);
}
ImageNextClip.onRelease = function() {
ImagePlayClip.playClip0.stop_mc1.removeMovieClip();
ImagePlayClip.playClip0.attachMovie(“play_mc”,“play_mc1”,1000);
//ImagePlayClip.playClip0.img_status.text = “Play”;
};
ImagePreviousClip.onRelease = function() {
ImagePlayClip.playClip0.stop_mc1.removeMovieClip();
ImagePlayClip.playClip0.attachMovie(“play_mc”,“play_mc1”,1000);
};
ImageNextClip.onPress = function() {
if (j>=3) {
j = 0;
}
p = j;
ImagePlayClip.playClip0.stop_mc1.removeMovieClip();
ImagePlayClip.playClip0.attachMovie(“play_mc”,“play_mc1”,1000);
ImageIndexClip0.imageIndex0.imageIndex_txt.background = true;
ImageIndexClip1.imageIndex1.imageIndex_txt.background = true;
ImageIndexClip2.imageIndex2.imageIndex_txt.background = true;

if (p == 0) {
    ImageIndexClip0.imageIndex0.imageIndex_txt.backgroundColor = 0x919090;
} else {
    ImageIndexClip0.imageIndex0.imageIndex_txt.backgroundColor = 0xCCCCCC;
}
if (p == 1) {
    ImageIndexClip1.imageIndex1.imageIndex_txt.backgroundColor = 0x919090;
} else {
    ImageIndexClip1.imageIndex1.imageIndex_txt.backgroundColor = 0xCCCCCC;
}
if (p == 2) {
    ImageIndexClip2.imageIndex2.imageIndex_txt.backgroundColor = 0x919090;
} else {
    ImageIndexClip2.imageIndex2.imageIndex_txt.backgroundColor = 0xCCCCCC;
}

//p = ImageIndexClip0.imageIndex0.imageIndex_txt.text;
//trace(p)
//_root.img_no.text = p;
ImagePlayClip.playClip0.stop_mc1.removeMovieClip();
ImagePlayClip.playClip0.attachMovie("play_mc","play_mc1",1000);
clearInterval(delay);
flag = false;
if (container.container2.getDepth() == 2) {
    swapPlace(container.container2);
}
container.container2._visible = false;
container.container1.loadMovie(picArray[p]);
_root.img_no.text = picIDArray[p];
j++;
if (_root.j&gt;=picTotal) {
    _root.j = 0;
    _root.k = 0;
    flag1 = true;
}

};
ImagePreviousClip.onPress = function() {
ImagePlayClip.playClip0.stop_mc1.removeMovieClip();
ImagePlayClip.playClip0.attachMovie(“play_mc”, “play_mc1”, 1000);
j–;
if (_root.j<0 && flag1 == true) {
_root.j = 4;
//_root.k = 5;
}
if (_root.j<=0 && flag1 == false) {
_root.j = 5;
}
flag1 = false;
q = j-1;
//trace(q)
//trace(j)
ImagePlayClip.playClip0.stop_mc1.removeMovieClip();
ImagePlayClip.playClip0.attachMovie(“play_mc”, “play_mc1”, 1000);
ImageIndexClip0.imageIndex0.imageIndex_txt.background = true;
ImageIndexClip1.imageIndex1.imageIndex_txt.background = true;
ImageIndexClip2.imageIndex2.imageIndex_txt.background = true;

if (q == 0) {
    ImageIndexClip0.imageIndex0.imageIndex_txt.backgroundColor = 0x919090;
} else {
    ImageIndexClip0.imageIndex0.imageIndex_txt.backgroundColor = 0xCCCCCC;
}
if (q == 1) {
    ImageIndexClip1.imageIndex1.imageIndex_txt.backgroundColor = 0x919090;
} else {
    ImageIndexClip1.imageIndex1.imageIndex_txt.backgroundColor = 0xCCCCCC;
}
if (q == 2) {
    ImageIndexClip2.imageIndex2.imageIndex_txt.backgroundColor = 0x919090;
} else {
    ImageIndexClip2.imageIndex2.imageIndex_txt.backgroundColor = 0xCCCCCC;
}

//p = ImageIndexClip0.imageIndex0.imageIndex_txt.text;
//_root.img_no.text = p;
ImagePlayClip.playClip0.stop_mc1.removeMovieClip();
ImagePlayClip.playClip0.attachMovie("play_mc", "play_mc1", 1000);
clearInterval(delay);
flag = false;
if (container.container2.getDepth() == 2) {
    swapPlace(container.container2);
}
container.container2._visible = false;
container.container1.loadMovie(picArray[q]);
_root.img_no.text = picIDArray[q];

};
ImageIndexClip0.onPress = function() {
j = 1;
ImageIndexClip0.imageIndex0.imageIndex_txt.background = true;
ImageIndexClip0.imageIndex0.imageIndex_txt.backgroundColor = 0x919090;
ImageIndexClip1.imageIndex1.imageIndex_txt.background = true;
ImageIndexClip1.imageIndex1.imageIndex_txt.backgroundColor = 0xCCCCCC;
ImageIndexClip2.imageIndex2.imageIndex_txt.background = true;
ImageIndexClip2.imageIndex2.imageIndex_txt.backgroundColor = 0xCCCCCC;

p = ImageIndexClip0.imageIndex0.imageIndex_txt.text;
//trace(p)
//_root.img_no.text = p;
_root.img_no.text = picIDArray[p-1];
ImagePlayClip.playClip0.stop_mc1.removeMovieClip();
ImagePlayClip.playClip0.attachMovie("play_mc", "play_mc1", 1000);
clearInterval(delay);
flag = false;
if (container.container2.getDepth() == 2) {
    swapPlace(container.container2);
}
container.container1.loadMovie(picArray[p-1]);

};
ImageIndexClip1.onPress = function() {
j = 2;
ImageIndexClip0.imageIndex0.imageIndex_txt.background = true;
ImageIndexClip0.imageIndex0.imageIndex_txt.backgroundColor = 0xCCCCCC;
ImageIndexClip1.imageIndex1.imageIndex_txt.background = true;
ImageIndexClip1.imageIndex1.imageIndex_txt.backgroundColor = 0x919090;
ImageIndexClip2.imageIndex2.imageIndex_txt.background = true;
ImageIndexClip2.imageIndex2.imageIndex_txt.backgroundColor = 0xCCCCCC;
p = ImageIndexClip1.imageIndex1.imageIndex_txt.text;
//_root.img_no.text = p;
_root.img_no.text = picIDArray[p-1];
ImagePlayClip.playClip0.stop_mc1.removeMovieClip();
ImagePlayClip.playClip0.attachMovie(“play_mc”, “play_mc1”, 1000);
clearInterval(delay);
flag = false;
if (container.container2.getDepth() == 2) {
swapPlace(container.container2);
}
container.container1.loadMovie(picArray[p-1]);
};
ImageIndexClip2.onPress = function() {
j = 3;
ImageIndexClip0.imageIndex0.imageIndex_txt.background = true;
ImageIndexClip0.imageIndex0.imageIndex_txt.backgroundColor = 0xCCCCCC;
ImageIndexClip1.imageIndex1.imageIndex_txt.background = true;
ImageIndexClip1.imageIndex1.imageIndex_txt.backgroundColor = 0xCCCCCC;
ImageIndexClip2.imageIndex2.imageIndex_txt.background = true;
ImageIndexClip2.imageIndex2.imageIndex_txt.backgroundColor = 0x919090;
p = ImageIndexClip2.imageIndex2.imageIndex_txt.text;

//_root.img_no.text = p;
ImagePlayClip.playClip0.stop_mc1.removeMovieClip();
ImagePlayClip.playClip0.attachMovie("play_mc", "play_mc1", 1000);
clearInterval(delay);
flag = false;
if (container.container2.getDepth() == 2) {
    swapPlace(container.container2);
}
container.container1.loadMovie(picArray[p-1]);

};

ImagePlayClip.onPress = function() {
flag1=true;

if (flag == true) {
    if (j == 0) {
        j = 3;
    }
    p = --j;
    ImagePlayClip.playClip0.stop_mc1.removeMovieClip();
    ImagePlayClip.playClip0.attachMovie("play_mc", "play_mc1", 1000);
    ImageIndexClip0.imageIndex0.imageIndex_txt.background = true;
    ImageIndexClip1.imageIndex1.imageIndex_txt.background = true;
    ImageIndexClip2.imageIndex2.imageIndex_txt.background = true;
    if (p == 0) {
        ImageIndexClip0.imageIndex0.imageIndex_txt.backgroundColor = 0x919090;
    } else {
        ImageIndexClip0.imageIndex0.imageIndex_txt.backgroundColor = 0xCCCCCC;
    }
    if (p == 1) {
        ImageIndexClip1.imageIndex1.imageIndex_txt.backgroundColor = 0x919090;
    } else {
        ImageIndexClip1.imageIndex1.imageIndex_txt.backgroundColor = 0xCCCCCC;
    }
    if (p == 2) {
        ImageIndexClip2.imageIndex2.imageIndex_txt.backgroundColor = 0x919090;
    } else {
        ImageIndexClip2.imageIndex2.imageIndex_txt.backgroundColor = 0xCCCCCC;
    }
    
    //p = ImageIndexClip0.imageIndex0.imageIndex_txt.text;
    //trace(p)
    //_root.img_no.text = p;
    ImagePlayClip.playClip0.stop_mc1.removeMovieClip();
    ImagePlayClip.playClip0.attachMovie("play_mc", "play_mc1", 1000);
    clearInterval(delay);
    flag = false;
    if (container.container2.getDepth() == 2) {
        swapPlace(container.container2);
    }
    container.container1.loadMovie(picArray[p]);
    _root.img_no.text = picIDArray[p];
    j++;
    if (j == 3) {
        j = 0;
        
    }
} else {
    flag = true;
    /*if (j&gt;5) {
    j = 0;
    k = 0;
    }*/
    if (j == 3) {
        j = 0;
        k = 0;
    }
    n = 3;
    i = 2;
    loadImage();
}

};
-----------------------------------------------------------**

XML code:

**<?xml version=“1.0”?>
<images>
<img pic=“images/p_0001.jpg” txt=“1” url=“feature1.html”/>
<img pic=“images/p_0002.jpg” txt=“2” />
<img pic=“images/p_0003.jpg” txt=“3” />
</images>