Actionscript - automate slideshow

I'm new to the actionscript world and I need help with this flash movie I'm trying to create. It's basically a slideshow w/a fadein and fadeout effect. The movie grabs the images out of a directory (via the path which is stored in an array). Now, I know how to move from one image to the next if I had a button or something, but I don't know how to automate the transition. Any help would be greatly appreciated.

Note: I've tried creating a mask to hide and show the images, I've also tried setInterval but both attempts have failed. Here's my code w/the button clicking. How do I change it for automation??

this.pathToPics = "images/flash/";

// fill this array with pics

this.pArray = ["image0.JPG", "image1.JPG", "image2.JPG", "image3.JPG", "image4.JPG"];

this.fadeSpeed = 20;

this.pIndex = 0;

// MovieClip methods ----------------------------------

// d=direction; should be 1 or -1

//loads an image automatically when you run animation

loadMovie(this.pathToPics+this.pArray[0], _root.photo);

MovieClip.prototype.changePhoto = function(d) {

// make sure pIndex falls within pArray.length

this.pIndex = (this.pIndex+d)%this.pArray.length;

if (this.pIndex<0) {

this.pIndex += this.pArray.length;

}

this.onEnterFrame = fadeOut;

};

MovieClip.prototype.fadeOut = function() {

if (this.photo._alpha>this.fadeSpeed) {

this.photo._alpha -= this.fadeSpeed;

} else {

this.loadPhoto();

}

};

MovieClip.prototype.loadPhoto = function() {

// specify the movieclip to load images into

var p = _root.photo;

//------------------------------------------

p._alpha = 0;

p.loadMovie(this.pathToPics+this.pArray[this.pIndex]);

this.onEnterFrame = loadMeter;

};

MovieClip.prototype.loadMeter = function() {

var i, l, t;

l = this.photo.getBytesLoaded();

t = this.photo.getBytesTotal();

if (t>0 && t == l) {

this.onEnterFrame = fadeIn;

} else {

trace(l/t);

}

};

MovieClip.prototype.fadeIn = function() {

if (this.photo._alpha<100-this.fadeSpeed) {

this.photo._alpha += this.fadeSpeed;

} else {

this.photo._alpha = 100;

this.onEnterFrame = null;

}

};

// Actions -----------------------------------------



// for button click transition

this.onKeyDown = function() {

if (Key.getCode() == Key.LEFT) {

this.changePhoto(-1);

} else if (Key.getCode() == Key.RIGHT) {

this.changePhoto(1);

}

};

Key.addListener(this);

#411272