PDA

View Full Version : timing a duplicate movie repeat


Rupert
05-15-2001, 09:47 AM
Hi - I have an animation where I am duplicating a movieClip that then moves from one side of the screen to the other. I want to be able to control the repeat rate of this duplication (possibly from a variable) so that end result would be like being able to control the speed of a conveyer belt. I have tried setting up something with getTimer (and even tried a controlled "random" scenario) without much success. Can anyone point me in the right direction?

Thanks in advance!
Rupert

Marx
05-19-2001, 01:26 PM
Hi Rupert...
Try following this example. It contains two MC's, one contains the timer and the other is duplicated at desired intervals:

1) Place an MC to the left of your stage, name it 'myMc'.

2) Attach this action to the MC:

onClipEvent (enterFrame) {
_root.newMc._x+=5;
}


Now for the timer MC:

3) Insert/New Symbol/Movie. You should be in MC editing mode.

4) Add an Input textfield, name it 'time'.

5) Add the actions that control the repeat rate;

a) Frame1:
stop ();


b) Frame2:
startTime = getTimer ()/1000;


c) Frame3:
timeNow = getTimer()/1000;
repeatRate = time;
timeDiff = timeNow-startTime;
if (timeDiff>=repeatRate) {
_root.myMc.duplicateMovieClip("newMc",1);
gotoAndStop (1);
}


d) Frame4:
gotoAndPlay (3);


6) Add the control button:

on (release) {
play ();
}


When you are in test movie mode type the amount of seconds you want the delay to be in the 'time' textfield then press the button.

Hope this helps.

Rupert
05-20-2001, 11:55 PM
Thanks for that! I am now well on the way to getting this thing finished - At last!!

Cheers,

Rupert