Firefox XML issue after adding simple piece of script

I had a working .swf which I used for getting news items from an XML file. I wanted the news items to be randomized so I added the following code:


newsitem = random(3) +1;
// generates number 1, 2 or 3.

if(newsitem==1) 
gotoAndPlay(2);

else if(newsitem==2) 
gotoAndPlay(3);

else 
gotoAndPlay(4);


The purpose is to get a random number and then jump to a corresponding frame. After I added this code, Firefox refuses to show my first news item completely. Sometimes all the texts are missing, sometimes just some. It doesn’t appear to be an XML issue - I tried switching places with the news items and it’s always the first item of the XML file that has this problem.

Is there something wrong with the code I added? I’m running out of ideas…