# How to loop MC once it is nested in the main scene?

**URL:** <https://forum.kirupa.com/t/how-to-loop-mc-once-it-is-nested-in-the-main-scene/1899>\
**Category:** flash\
**Created:** [April 30, 2002, 2:02am UTC](https://forum.kirupa.com/t/how-to-loop-mc-once-it-is-nested-in-the-main-scene/1899 "2002-04-30T02:02:12Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 30, 2002, 2:02am UTC](https://forum.kirupa.com/t/how-to-loop-mc-once-it-is-nested-in-the-main-scene/1899/1 "2002-04-30T02:02:12Z")

</div>

Hello.

I made a MC and put it on the main scene. The MC has its length of about 200 frame. I want it to play 10 times [loop!] on the main scene before jumping to the next scene. It is pretty easy if I add frame to the MC, but imagine its total length. I think the script is the best bet. Please let me know how to write script to make this happen. Should the script be put on the scene or in the MC and I do not know which one suits this requirement best.

Thank you.

Confused!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 30, 2002, 3:17am UTC](https://forum.kirupa.com/t/how-to-loop-mc-once-it-is-nested-in-the-main-scene/1899/2 "2002-04-30T03:17:16Z")

</div>

in the last frame of your clip (has 2 b a keyframe), put actions s’thing like this (do not copy/paste this, incorrect scripting!): counter  
if (counter\<10){gotoAndPlay (1);}else{\_root.play;}//sends the clip back to 1st frame if counter isn’t up to 10, or makes the main timeline play if it is  
On 1st frame of clip: counter++; //adds 1 to counter every time this frame is played…there’s other ways, you get the basic idea of using a flag/counter which you increment every time the clip is played, and check before playing it again…?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 30, 2002, 9:27pm UTC](https://forum.kirupa.com/t/how-to-loop-mc-once-it-is-nested-in-the-main-scene/1899/3 "2002-04-30T21:27:06Z")

</div>

In other words :

```auto
 (counter++<10) ? gotoAndPlay (1) : _root.play;

```

pom 0]

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 2, 2002, 2:10am UTC](https://forum.kirupa.com/t/how-to-loop-mc-once-it-is-nested-in-the-main-scene/1899/4 "2002-05-02T02:10:08Z")

</div>

Thank a lot. I will try.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 2, 2002, 4:32am UTC](https://forum.kirupa.com/t/how-to-loop-mc-once-it-is-nested-in-the-main-scene/1899/5 "2002-05-02T04:32:36Z")

</div>

man those MX scripting shortcuts are confusing… what’s the “?” do exactly?

For the record… “So confused” is a great name… you should try to register that with Ezboard… it’s kind of like the Quake III player who has the name “Shoot at me” 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 2, 2002, 11:10am UTC](https://forum.kirupa.com/t/how-to-loop-mc-once-it-is-nested-in-the-main-scene/1899/6 "2002-05-02T11:10:34Z")

</div>

Actually, that’s not an MX shortcut, it was there in F5 too.

Basically, you put it that way :

```auto
  (condition) ? (if true) : (if false) ;
for instance :
(Math.random()>0.5) ? trace ("number superior to .5") : trace ("inferior") ;

```

pom

(sorry Pom… had to remove the emoticons to understand that)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 2, 2002, 11:30am UTC](https://forum.kirupa.com/t/how-to-loop-mc-once-it-is-nested-in-the-main-scene/1899/7 "2002-05-02T11:30:07Z")

</div>

thats sexy, I like it…So, wait, if you learn something new everyday, and I just learned something, does that mean I still have to go to my classes? 🙂

I have a big Biology test coming up tomorrow…wish me luck, i need to study my ass off tonight…
