hi I have this code that duplicates an MC on stage , my problem is , after the duplication i know every MC as a unique name, but I can´t access them, I don´t understand why, can someone explain tthis to me please tahnks
/////
button_mc._visible = false;
var maxClips = 10;
var i = 0;
function addClip() {
i++;
newClip = _root.button_mc.duplicateMovieClip("newClip"+i, i);
newClip._y = i*(newClip._height+10);
maxClips variable
if (i>=maxClips) {
//clear the interval and stop running this function
clearInterval(addClipsInterval);
}
I’ll bet your problem is that you are trying to use newClip to access each newly duplicated MC. I think the problem is that newClip isn’t an object like you want it to be. You need to first duplicate the MC and then reference it into your newClip using eval(). Something like this:
Now try to access something like newClip._y or whatever. Im like 99% sure thats the right path for you. Whenever I try something like this, I use code like:
button_mc._visible = false;
myClips = [] ;
var maxClips = 10;
var i = 0;
function addClip() {
i++;
newClip = _root.button_mc.duplicateMovieClip("newClip"+i, i);
myClips.push ( newClip ) ;
newClip._y = i*(newClip._height+10);
if (i>=maxClips) {
//clear the interval and stop running this function
clearInterval(addClipsInterval);
}
}
var addClipsInterval = setInterval(addClip, 100);
Then you can access them with myClips[2] for instance.