# Passing Arrays Between Movies

**URL:** <https://forum.kirupa.com/t/passing-arrays-between-movies/397>\
**Category:** flash\
**Created:** [July 16, 2002, 2:36pm UTC](https://forum.kirupa.com/t/passing-arrays-between-movies/397 "2002-07-16T14:36:06Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ControlB](https://avatars.discourse-cdn.com/v4/letter/c/c68b51/32.png) [@ControlB](https://forum.kirupa.com/u/ControlB)\
**Post date:** [July 16, 2002, 2:36pm UTC](https://forum.kirupa.com/t/passing-arrays-between-movies/397/1 "2002-07-16T14:36:06Z")

</div>

I have a SWF movie (“bits.swf”) with an array (“things”) variable in it.

I use loadMovie to load bits.swf into my main movie.

Q: how can I read/use/transfer the values in array “things” from my main movie?

Thanks!

---

<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:** [July 16, 2002, 3:06pm UTC](https://forum.kirupa.com/t/passing-arrays-between-movies/397/2 "2002-07-16T15:06:27Z")

</div>

Define an array in the loaded movie and populate it from from the holder movie.  
If you’ve loaded into a level the syntax will be something like myNewArray=\_level0.myOldArray.slice()  
If you’ve loaded into a movie clip instance the syntax will be something like myNewArray=\_root.myOldArray.slice()

---

<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:** [July 16, 2002, 4:12pm UTC](https://forum.kirupa.com/t/passing-arrays-between-movies/397/3 "2002-07-16T16:12:48Z")

</div>

I need to do the opposite, though: define an array in the holder movie and populate it from the loaded movie (in this case, “bits.swf”).

Is there any way of doing 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:** [July 16, 2002, 4:36pm UTC](https://forum.kirupa.com/t/passing-arrays-between-movies/397/4 "2002-07-16T16:36:34Z")

</div>

Either:

A  
Call the loaded array from the loader timeline:  
myLoaderArray=\_level1.myLoadedArray.slice();  
myLoaderArray=instanceName.myArray.slice();

or

B  
Throw the loaded array at the loader timeline when it has loaded  
i.e. put this in the first frame of “bits.swf”  
\_level0.myLoaderArray=myLoadedArray.slice();  
\_root.myLoaderArray=myLoadedArray.slice();

Option B is the more reliable as the swf has definitely loaded and instantiated before the code executes. If you’re using option A check that bits.swf has fully loaded before you attempt to reference its properties

---

<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:** [July 16, 2002, 5:25pm UTC](https://forum.kirupa.com/t/passing-arrays-between-movies/397/5 "2002-07-16T17:25:33Z")

</div>

It’s working now - thanks for all your help, JSK!
