XML end of the file

Hi All
I have an XML file which has a set of swf 's to be played.How do I figure out that I am playing the last swf and play the first swf again.

I would be happy if someone gives me an actionscript logic for this…!

Thanks in Advance
Nirmal.