Duplicate Mc with delay

hey everyone

Just posting bu the off chance that someone might be able to shed some light on my problem.

Refering back to this tutorial http://www.kirupa.com/developer/actionscript/grid.htm im trying to duplicate my mc with a delay of a about 1sec each time. Is this possible, any help would be great.

// code so far
gridx=50;
gridy=50;
num=0;
for (var i=0;i < 10;i++)
{
for (var j=0;j < 10;j++)
{
dot.duplicateMovieClip(“dot”+num,num);
mc=this[“dot”+num];
mc._x=gridxi;
mc._y=gridy
j;
num++;
}
}
dot._visible=0;

Im working on this website http://www.propcomm.co.uk/anambar , except ive had to manualy create each circle, just to give you some idea.

Thanks very much inadvance
Martin//…

http://www.imbuez.co.uk

why r u using two for-s and you can use one of the for() variables instead of num if you kno what i mean…

this should give you a 10 frame delay
in _root

_root.delay=10;

in the loop, replace mc._x= and mc._y with this

mc.delayvar=0;
mc.k=i;
mc.l=j;
mc.onEnterFrame=function(){
if(this.delayvar>=_root.delay){
this._x=_root.gridthis.k;
this._y=_root.grid
this.l;
} else {
this.delayvar+=1;
}
}

and nevermind about the two loops… :wink: (doh)

It’s pretty easy and I could just post one of those why dont you search replies cause this topic gets covered a lot but I’ll save you some time and trouble since this is a help forum…
Put this in flash
[AS]
function delayMyMovies(){
dot.duplicateMovieClip(“dot”+num,num);
mc=this[“dot”+num];
mc._x=gridxi; //you’ll have to figure out the math here to make the locations right
mc._y=gridy
j;// I would suggest using _root.num somehow
_root.num++;
if(_root.num>numberOfMoviesNeeded){ //this is just for cleanup no need to have variables that arent used anymore
clearInterval(delayDuplicate);
delete _root.num;
}
}
delayDuplicate = setInterval(“delayMyMovies”,1000); //this delays one second the 1000 is milliseconds
[/AS]

If you have any sort of trouble with this let me see your modifications and I will do what I can to help you get it working.
Good Luck,
Shawn

That im afraid all looks foreign to me. ive pasted it into my movie but i just seem to get the one mc. Is there any chance you could explain what youve written so i could learn please.
Thanks bruv
Martin//…

i can explain mine :slight_smile:
when the clip is loaded it sets a variable to zero and adds one to it every frame until it equals your number (_root.delay) and does it to every mc - simple :stuck_out_tongue:

hi uudens, thanks for taking the time to do that. Your explanation makes things alot clearer …
I still seem to be struggling. here is have my origional code with yours

 
_root.delay=10; 
gridx=50;
gridy=50;
num=0;
for (var i=0;i < 10;i++)
{
for (var j=0;j < 10;j++)
{
dot.duplicateMovieClip("dot"+num,num);
mc=this["dot"+num];
mc.delayvar=0;
mc.k=i;
mc.l=j;
mc.onEnterFrame=function(){
if(this.delayvar>=_root.delay){
this._x=_root.grid*this.k;
this._y=_root.grid*this.l;
} else {
this.delayvar+=1;
}
} num++;
}
}
dot._visible=0;

 

Im pretty sure that what im doing here is way of track, thanks for looking in advance.

Martin//…