I need some help with my code, when my array of movies is done playing I need to repeat from the begining of the array or start over again with the first item in the array. Can some one help?
stop();
// change title
_global.changeTitle = function(title:String) {
// set chapter text
_root.vid.title.autoSize = true;
_root.vid.title.text = title;
// shadow text
_root.vid.title2.autoSize = true;
_root.vid.title2.text = title;
};
changeTitle("A Global Industry");
//
// create the array of filenames
var vidList:Array = new Array("section1768K_Stream.flv", "section2768K_Stream.flv", "section3768K_Stream.flv", "section4768K_Stream.flv", "section5768K_Stream.flv", "Closing768K_Stream.flv");
// set the current video id
var currentVideo:Number = 0;
// create the listener for the media
var myListener:Object = new Object();
var referrer = this;
// set up the listener
myListener.complete = function(eventObject) {
trace("media is Finished");
// increment the current video
referrer.currentVideo++;
// play the next one
referrer.playMovie();
};
_root.my_video.addEventListener("complete", myListener);
setupMedia();
playMovie();
// only has to set the player settings once
function setupMedia():Void {
_root.my_video.stop();
_root.my_video.autoPlay = true;
_root.my_video.activePlayControl = true;
_root.my_video.controllerPolicy = 'on';
_root.my_controller.volume = 100;
}
// set the media to the current video and play it
function playMovie():Void {
_root.my_video.setMedia("videos/"+referrer.vidList[currentVideo]);
//trace(referrer.vidList[currentVideo]);
if (currentVideo == 0) {
changeTitle("A Global Industry");
}
if (currentVideo == 1) {
changeTitle("A Global Enemy ");
}
if (currentVideo == 2) {
changeTitle("Micro-Abrasive Dust: An Engines Worst Enemy");
}
if (currentVideo == 3) {
changeTitle("Micro-Abrasive Dust Meets its Match");
}
if (currentVideo == 4) {
changeTitle("Either Your Protected or You're Not...There Is No In-Between");
}
if (currentVideo == 5) {
changeTitle("Call To Action ");
}
_root.my_video.play(0);
}