Timeline code firing two times after goto*()

This is my movieclip, its on the root:

frame1 code:


trace("clip()");
stop();

frame 2 code:


trace("secondframe");
trace(Math.random());

frame3 code:


trace("thirdframe");

In the root timeline i have a line which tells this movieclip to go to second frame:


myClip.gotoAndStop(2);

What i expected from output:


clip()
secondframe
-some random number-

what i’m getting:


secondframe
-random number 1-
secondframe
-random number 2-

The code on second frame is “firing” two times, i believe it is not supposed to work this way…

the only “fix” i have found was to add a nextFrame() in second frame code, just after tracing the random number, but then, the code in third frames fires for 2 times, and this is my output:


secondframe
-random number-
thirdframe
thirdframe

I’m feeling like a total newbie to flash now, it looks weird. I dont remember facing this before.

EDIT: just tried changing my document to AS2 (exactly same code, didnt change anything), and this problem does not happen