# Cant make metronome stick stop

**URL:** <https://forum.kirupa.com/t/cant-make-metronome-stick-stop/48400>\
**Category:** Uncategorized\
**Created:** [April 13, 2004, 5:16am UTC](https://forum.kirupa.com/t/cant-make-metronome-stick-stop/48400 "2004-04-13T05:16:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tapleq](https://avatars.discourse-cdn.com/v4/letter/t/48db29/32.png) [@tapleq](https://forum.kirupa.com/u/tapleq)\
**Post date:** [April 13, 2004, 5:16am UTC](https://forum.kirupa.com/t/cant-make-metronome-stick-stop/48400/1 "2004-04-13T05:16:12Z")

</div>

hi guys…i’m creating this metronome thing that gives tempo…i’ve got the metronome stick (an MC) to rotate and sound like how a metronome should but umm i cant get it to stop (i’ve a stop button to control this)

anyone hv any idea wat i shld do, i’m not very good at writing actionscripts and these codes are done with help from a fren…  
here’s the codes on the stick MC

[AS]onClipEvent (load) {  
tick = new Sound();  
tick.attachSound (“ting”);  
//max 60 deg to left/right  
this.limitAngle = 40;  
this.timer = new Date();  
init();  
function init() {  
this.bpm = \_root.beatsPerMin;  
//start at -60 deg. to the left  
this.\_rotation =-1_this.limitAngle;  
//beats per second  
this.beatsPerSec = this.bpm/60;  
//secPerBeat  
this.secPerBeat = 1/this.beatsPerSec;  
//how big an angle to move per millisec  
this.anglePerMilliSec = this.limitAngle_2_this.beatsPerSec/1000;  
//get the current millisec  
this.TimeCheck = this.timer.getTime();  
this.TimeSinceLastBeat = this.timer.getTime();  
//initial direction of movement to the right  
this.direction = 1;  
}  
}  
onClipEvent (enterFrame) {  
this.timer = new Date();  
this.timePassed = this.timer.getTime()-this.TimeCheck;  
this.TimeCheck = this.timer.getTime();this.\_rotation = this.\_rotation+(this.direction_this.timePassed\*this.anglePerMilliSec);  
//trace("time since last beat: " + (this.timer.getTime() - this.TimeSinceLastBeat));  
//trace("millisec Per beat: " + (this.secPerBeat \* 1000));  
if (this.timer.getTime() - this.TimeSinceLastBeat \>= this.secPerBeat \* 1000 ) {this.TimeSinceLastBeat = this.timer.getTime();  
//change direction of movement  
this.direction _= -1;  
if(direction == 1){  
tick.start();  
this.\_rotation = -1_this.limitAngle;  
}  
else{  
tick.start();  
this.\_rotation = this.limitAngle;  
}  
}  
}  
onClipEvent (load) {  
stopRotate();  
function stopRotate() {  
this.bpm = \_root.beatsPerMin;  
this.\_rotation = false;  
}  
}[/AS]

then on the stop button, i’ve this codes  
[AS]on (press) {\_root.metronome.stopRotate();}[/AS]

thx
