PDA

View Full Version : FMX-duplicating MC in sequence



jagunco
July 9th, 2003, 01:37 PM
I want to ask if someone can follow me in the right direction of this matter, I want to have a function to duplicating mc or better to place mc on the stage in sequence, imagine, one after anotherm not all when the movie starts, this is possible whit actionscript? I thought to try to use the set Interval, but I donīt know if it is the right way to do it.


thanks

jagunco BOY

A life less ordinary*

lostinbeta
July 9th, 2003, 02:29 PM
//make original clip on stage invisible
targetClip._visible = false;
//set how many duplicated clips
var maxClips = 10;
//variable to be used in adding clips
var i = 0;
//function to add clip
function addClip() {
//increment the i variably by 1
i++;
//duplicate target clip
newClip = targetClip.duplicateMovieClip("newClip"+i, i);
//move new clip along _x axis
newClip._x = i*(newClip._width+10);
//if the variable i is greater than or equal to the maxClips variable
if (i>=maxClips) {
//clear the interval and stop running this function
clearInterval(addClipsInterval);
}
}
//use setInterval to call the addClip function every 100 milliseconds
var addClipsInterval = setInterval(addClip, 100);



Theres an example, create a clip on the stage with the instance targetClip to see how it works.

λ
July 9th, 2003, 02:42 PM
Just for an example of how you might use this, here is the .fla for my footer. If you don't understand anything, just ask. ;)

jagunco
July 9th, 2003, 03:48 PM
lostinbeta

this is precisely what i needed, , I must workmore on this, because i want to use it whit some Image Box, i think is cooler to have images appearing one witch time. I had alays problems whit duplicating movie clips to amke "grids" (I think the term is this), but Iīm working on it. You know Iīm a fun of less than 10 frames ussed in the main timeline.

:)

njs12345

that was not what I was talking about, but thanks anyway for helping

λ
July 9th, 2003, 04:05 PM
Never mind. I was just trying to help you get the concept.

Anyway, glad you fixed your problem.

jagunco
July 9th, 2003, 05:37 PM
:)

i talked earliar that i thought

i was trying to use it whit MPIIMAGE BOX, and image box that i found in Macromedia exchange, but the thing dosenīt work. When i duplicate the image box, itīs okay, but whe i try to target every instance of it, the thing dosenīt work.

Do you think youcan lok at both codes, I was trying some experiments