# \_parent.content.\[variable\].gotoAndPlay() ???

**URL:** <https://forum.kirupa.com/t/-parent-content-variable-gotoandplay/182536>\
**Category:** Uncategorized\
**Created:** [March 19, 2006, 5:05am UTC](https://forum.kirupa.com/t/-parent-content-variable-gotoandplay/182536 "2006-03-19T05:05:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bartszyszka](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/bartszyszka/32/1599_2.png) [@bartszyszka](https://forum.kirupa.com/u/bartszyszka)\
**Post date:** [March 19, 2006, 5:05am UTC](https://forum.kirupa.com/t/-parent-content-variable-gotoandplay/182536/1 "2006-03-19T05:05:31Z")

</div>

Hello,

I have some code that duplicates a movie called movieclip1 as movieclip2, movieclip3, movieclip4, etc. That movieclip has another clip inside of it and I want to be able to activate that clip like so:

numMovies=4  
while(numMovies\>0) {  
\_parent.content.[“movieclip”+numMovies].gotoAndPlay(4);  
numMovies–;  
}

But that doesn’t work. The only thing I’ve been able to find is for movieclips directly at \_root or “this” that can be accessed like this[“movieclip”+numMovies].gotoAndPlay(4) but my movie clip isn’t at \_root or in the current clip. It’s within a bunch of movie clips. So basically I want to use gotoAndPlay with a relative path to the movie clip and a variable move clip name.

The number of movieClips changes and rather than defining a fixed number of movies I’d rather gotoAndPlay only the movies that are actually there…

Any ideas?

- Bart

---

<div class="post-metadata">

**Author:** ![TheCanadian](https://avatars.discourse-cdn.com/v4/letter/t/67e7ee/32.png) [@TheCanadian](https://forum.kirupa.com/u/TheCanadian)\
**Post date:** [March 19, 2006, 5:17am UTC](https://forum.kirupa.com/t/-parent-content-variable-gotoandplay/182536/2 "2006-03-19T05:17:34Z")

</div>

```auto
numMovies = 4;
while (numMovies > 0) {
 _parent.content["movieclip" + numMovies].gotoAndPlay(4);
 numMovies--;
}

```
