Random internal mc

does anyone know how to do a random internal movie clips NOT calling external mcs with loadmovie??

Let’s say I have two internal mc’s with instance name : my_mc1, my_mc2
and I want them to load randomly in starting in frame 2

here what I did so far:

var tab_mc = [this.my_mc1, this.my_mc2];

function randomMC(tab_mc) {
var i=tab_mc.length;
var r = (Math.floor(Math.random()*i);
return tab_mc[r];
}

// How can I load randomly each of them starting in frame 2?
// gotoAndPlay() is only accept frame number or label
onEnterFrame = function() {

}

I’m not sure what you mean by ‘How can I load randomly each of them starting in frame 2’, but I’m assuming you want to randomly load one or the other in frame 2. If that’s the case, place this AS on frame 2:

var tab_array:Array = new Array("my_mc1","my_mc2");
var target:String = tab_array[Math.floor(Math.random()*2)];
this.attachMovie(target, target, 0);

thanks for your fast reply but what I mean is:

I have 2 mc’s with instance name (my_mc1, my_mc2). Now if u go into each of them, the sequence starts to play at frame 2 and on, I have a stop(); script in frame 1.

I want to be able to load randomly each of them in my _root
Is there a way to do it??

What ever the function returns, when you use attachMovie just do a gotoAndPlay(2); after it.