I have a similar problem.
I want to load movies randomly. I made the script, but it doesn't seem to work.
This is what I have:
-
moviename = ["imovie1", "imovie2", "imovie3", "imovie4"];
-
-
function randomise() {
-
_root.ilogo.play();
-
i = moviename.length;
-
k = Math.floor(Math.random()*i);
-
moviename[k].play();
-
trace(moviename[k]);
-
}
-
A short explanation. All my movies are external FLV but I recall them in different movies on my main timeline. So for every FLV I have a separate movie. (the reason why I do so is because I added different cue points to the different FLV's, but that's not of any importance in this thread).
So I made an array with the instances of the different movies.
Then I randomly pick a number.
By using moviename[k] I'm displaying value k out of array moviename.
However it doesn't seem to work.
I put the trace in to check if he is actually getting the value out of the array and that is the case. So I can see him randomly picking a number but when I try to play it, he won't do it.
So the problem lies in the line: moviename[k].play();
However when I put an instance name in place of moviename[k] it does play it. Probably I'm forgetting something but I don't know what. If someone can help me, please do!
I'm using AS 2.0