# Timeline code firing two times after goto\*()

**URL:** <https://forum.kirupa.com/t/timeline-code-firing-two-times-after-goto/296429>\
**Category:** flash\
**Created:** [September 15, 2009, 1:11am UTC](https://forum.kirupa.com/t/timeline-code-firing-two-times-after-goto/296429 "2009-09-15T01:11:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![StridBR](https://avatars.discourse-cdn.com/v4/letter/s/71e660/32.png) [@StridBR](https://forum.kirupa.com/u/StridBR)\
**Post date:** [September 15, 2009, 1:11am UTC](https://forum.kirupa.com/t/timeline-code-firing-two-times-after-goto/296429/1 "2009-09-15T01:11:34Z")

</div>

This is my movieclip, its on the root:

frame1 code:

```auto

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

```

frame 2 code:

```auto

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

```

frame3 code:

```auto

trace("thirdframe");

```

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

```auto

myClip.gotoAndStop(2);

```

What i expected from output:

```auto

clip()
secondframe
-some random number-

```

what i’m getting:

```auto

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:

```auto

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
