Rotation with time (prob easy *noob here)

I have a flash file that is 730px by 250 tall. It has 3 buttons that when clicked shows the image assigned to the button. The image is in an XML file so i can change them quickly. The buttons do work.

Now the next thing im trying to achieve is an autoplay. I want flash to rotate automatically between the images on the buttons. Below is the code i have and im not sure if im even going the right way with this but here it is. My goal is to get something like what is on the home page of www.genielift.com.


function rotator(Event:Timer) {
 var i=1;
 while (i<=1000) {
  if (i<=475) {
   ldImage.source = "photos/"+barXML.bar[0].photo;
  } else if (i>=476) {
   ldImage.source = "photos/"+barXML.bar[1].photo;
  } else if (i==999) {
   i=1;
  } else {
   ldImage.source = "photos/"+barXML.bar[2].photo;
  }
  trace("This code is repeated");
  i++;
 }
}

Thanks,
Justin