Play Random Movie Clips by main timeline progress
I have 48 movie clips numbered as follows:
Music_mc1, Music_mc2, Music_mc3, etc. to Music_mc48
I need a code that will trigger a random movie clip at each location where the code resides on the main timeline.
Here is what I have:
var SelectMC: Number = 0; {
function GetMC(): void {
var SelRandom: Number = Math.random();
SelectMC = Math.round(SelRandom * 47 + 1);
//trace (SelectMC);
}
GetMC();
var Holder: Object = new Object();
Holder = ("Music_mc" + String(SelectMC));
trace(Holder);
this[Holder].gotoAndPlay(2);
}
By the Output panel, the random MCs are selected correctly. But the swf stops at the first instance of the code (frame 222), and I get this error message:
TypeError: Error #1010: A term is undefined and has no properties.
at Unit19_fla::MainTimeline/frame222()
All help is appreciated!
