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();
};