# Easy Programming Question

**URL:** <https://forum.kirupa.com/t/easy-programming-question/298267>\
**Category:** flash\
**Created:** [October 15, 2009, 6:28pm UTC](https://forum.kirupa.com/t/easy-programming-question/298267 "2009-10-15T18:28:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![marcelomdsc](https://avatars.discourse-cdn.com/v4/letter/m/aca169/32.png) [@marcelomdsc](https://forum.kirupa.com/u/marcelomdsc)\
**Post date:** [October 15, 2009, 6:28pm UTC](https://forum.kirupa.com/t/easy-programming-question/298267/1 "2009-10-15T18:28:08Z")

</div>

Hello, I know very little programming and I have a doubt.

If I have for example a simple timeline with 2 labels.  
The first one is called “Intro” and the second one is called “Loop”.

So I would like to make the playhead start on frame 1 (“Intro” starts) and when it  
gets to frame 100 (“Loop” ends), make it loop 3 times and then go back to frame 1.

So I would simply write the code:

```auto

for (loops=0;loops<=4;loops++){
      gotoAndPlay("Loop");
      }
gotoAndPlay("Intro");

```

Should that work?  
Lets say it does, how would it increment loops to more than 1,  
if when its incremented to 1 the playhead goes to frame 1,  
runs that code again, so loops would be assigned 0 again, right?

Thanks, Marcelo.

PS: Let me know if i didnt make myself clear.
