View Full Version : Creating an array of movie clips
SuperDaiv
May 1st, 2002, 06:54 PM
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.
ilyaslamasse
May 2nd, 2002, 07:02 AM
what do you mean ?
pom 0]
SuperDaiv
May 2nd, 2002, 09:01 AM
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.
SuperDaiv
May 2nd, 2002, 09:02 AM
(and the images will be in movie clips)
suprabeener
May 2nd, 2002, 12:47 PM
you can go about it two ways.
say your movies are named "zero","one","two" ... "nineteen" and reside in _root.
either have the array contain strings that will evaluate to be the movie.
_root.myArray = ["zero","one","two" ... "nineteen"];
then to call them:
_root[_root.myArray[4]];
would refer to the movie named "four"
or (this is probably better) populate the array with actual references to the movies:
_root.myArray = [_root.zero,_root.one,_root.two ... _root.nineteen];
then referring to the array reference is the same as referring to the movie, so to make "eleven" play:
_root.myArray[11].play();
SuperDaiv
May 2nd, 2002, 01:10 PM
I love you.
byis
May 2nd, 2002, 01:56 PM
This idea might work for what im trying to do as well. Im trying to create next/previous track buttons for audio player.
I 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?
Say I have 10 songs in root called 0.swf - 9.swf.
suprabeener
May 2nd, 2002, 03:11 PM
since the loadMovie command is expecting a string as the argument, the first method would probably work best for your purposes:
_root.songArray = ["0.swf',"1.swf","2.swf"...];
and to load a random song into _level10:
loadMovieNum(_root.songArray[random(_root.songArray.length)],10);
or song number 8:
loadMovieNum(_root.songArray[8],10);
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.