Passing Arrays Between Movies

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?


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()

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?


Call the loaded array from the loader timeline:


Throw the loaded array at the loader timeline when it has loaded
i.e. put this in the first frame of “bits.swf”

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

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