# Creating an array of movie clips

**URL:** <https://forum.kirupa.com/t/creating-an-array-of-movie-clips/2707>\
**Category:** flash\
**Created:** [May 1, 2002, 10:54pm UTC](https://forum.kirupa.com/t/creating-an-array-of-movie-clips/2707 "2002-05-01T22:54:09Z")\
**Posts on this page:** 8\
**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:** [May 1, 2002, 10:54pm UTC](https://forum.kirupa.com/t/creating-an-array-of-movie-clips/2707/1 "2002-05-01T22:54:09Z")

</div>

Does anybody know how to go about creating an array of movie clips? Can it be done? I can’t find it in any of my books.

---

<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:02am UTC](https://forum.kirupa.com/t/creating-an-array-of-movie-clips/2707/2 "2002-05-02T11:02:09Z")

</div>

what do you mean ?\r\rpom 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, 1:01pm UTC](https://forum.kirupa.com/t/creating-an-array-of-movie-clips/2707/3 "2002-05-02T13:01:45Z")

</div>

Well i have about 20 images, and depending on a variable (which will hold a number 0 to 19), i want to scroll (through a loop that sets the \_x property of) the corresponding image across the screen.

---

<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, 1:02pm UTC](https://forum.kirupa.com/t/creating-an-array-of-movie-clips/2707/4 "2002-05-02T13:02:47Z")

</div>

(and the images will be in movie clips)

---

<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:47pm UTC](https://forum.kirupa.com/t/creating-an-array-of-movie-clips/2707/5 "2002-05-02T16:47:15Z")

</div>

you can go about it two ways.\r\rsay your movies are named “zero”,“one”,“two” … “nineteen” and reside in \_root.\r\reither have the array contain strings that will evaluate to be the movie.\r\r\_root.myArray = [“zero”,“one”,“two” … “nineteen”];\r\rthen to call them:\r\r\_root[\_root.myArray[4]];\r\rwould refer to the movie named “four”\r\ror (this is probably better) populate the array with actual references to the movies:\r\r\_root.myArray = [\_root.zero,\_root.one,\_root.two … \_root.nineteen];\r\rthen referring to the array reference is the same as referring to the movie, so to make “eleven” play:\r\r\_root.myArray[11].play();\r

---

<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, 5:10pm UTC](https://forum.kirupa.com/t/creating-an-array-of-movie-clips/2707/6 "2002-05-02T17:10:03Z")

</div>

I love you.

---

<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, 5:56pm UTC](https://forum.kirupa.com/t/creating-an-array-of-movie-clips/2707/7 "2002-05-02T17:56:30Z")

</div>

This idea might work for what im trying to do as well. Im trying to create next/previous track buttons for audio player.\rI could set all my external files into an array but I couldnt really assign them a number would have to have some type of formula involved. Any suugestions suprabeener?\r\rSay I have 10 songs in root called 0.swf - 9.swf.\r

---

<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, 7:11pm UTC](https://forum.kirupa.com/t/creating-an-array-of-movie-clips/2707/8 "2002-05-02T19:11:01Z")

</div>

since the loadMovie command is expecting a string as the argument, the first method would probably work best for your purposes:\r\r\_root.songArray = ["0.swf’,“1.swf”,“2.swf”…];\r\rand to load a random song into \_level10:\r\rloadMovieNum(\_root.songArray[random(\_root.songArray.length)],10);\r\ror song number 8:\r\rloadMovieNum(\_root.songArray[8],10);\r
