Looping from timeline creating weird ending

I have imported a gif animation into flash and placed it over a background on a lower level. I want to flash file to loop but at the end part of the background drops out and then the gif file flashes random images. Any help would be great.