# Spinning wheel problem

**URL:** <https://forum.kirupa.com/t/spinning-wheel-problem/262395>\
**Category:** Uncategorized\
**Created:** [June 5, 2008, 4:35pm UTC](https://forum.kirupa.com/t/spinning-wheel-problem/262395 "2008-06-05T16:35:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![buddymink](https://avatars.discourse-cdn.com/v4/letter/b/8797f3/32.png) [@buddymink](https://forum.kirupa.com/u/buddymink)\
**Post date:** [June 5, 2008, 4:35pm UTC](https://forum.kirupa.com/t/spinning-wheel-problem/262395/1 "2008-06-05T16:35:39Z")

</div>

Hi all,

I’m trying to figure out how to stop the onEnterFrame function on this spinning wheel script. I can have it rotate the wheel while arrow button is pressed, but when the wheel stops, the onEnterFrame function still performing the “slowDown” function. How do I stop it? Here’s the script attached on the 1st frame

Thanks.  
Buddy

* * *

function spinWheel(myTarget) {  
whell\_rotation = 0;  
myRandom = 0;  
//Optional allow press of wheel to spin.  
\_root.onEnterFrame = function() {  
myTarget.\_rotation += whell\_rotation;  
};  
function slowDown() {  
myTarget.onEnterFrame = function() {  
whell\_rotation -= \_root.myRandom;  
trace(\_root.myRandom);  
if (whell\_rotation\<=0) {  
whell\_rotation = 0;  
//\_root.clicker.gotoAndStop(1);  
}  
};  
};  
speedup = function () {  
myTimer = getTimer();  
myTarget.onEnterFrame = function() {  
whell\_rotation++;  
//\_root.clicker.gotoAndPlay(“clickStart”);  
if (whell\_rotation\>=10) {  
whell\_rotation = 10;  
pauseTimer = getTimer();  
timeTrace = pauseTimer-myTimer;  
trace(timeTrace);  
if (timeTrace\>4000) {  
slowDown();  
}  
}  
};  
};  
}

spinWheel(\_root.wheel);

// button script  
arrow\_btn.onRelease = function() {  
myRandom = Math.random()\*.30;  
if (myRandom\<=.10) {  
myRandom = .10;  
}  
trace(myRandom);  
speedup();  
};

---

<div class="post-metadata">

**Author:** ![alaric](https://avatars.discourse-cdn.com/v4/letter/a/f475e1/32.png) [@alaric](https://forum.kirupa.com/u/alaric)\
**Post date:** [July 10, 2008, 3:04am UTC](https://forum.kirupa.com/t/spinning-wheel-problem/262395/2 "2008-07-10T03:04:31Z")

</div>

hey, ive tested your code. but i dont see any problem, its fine spinning and stopping.
