please review : how to stop a count when the movie reached a specific frame?
Basically, i want to stop the Distvar from ticking after i reached the last frame ( which is 151 ) or the first frame of the mc, myMC1. I tried using
if (cfrm==1 || cfrm==151) {
//stop
}
but it didn't work coz if the ymouse is still within 0-175 or 225-400, the Distvar will still continue ticking...
so any ideas? below is my script.
// Fort Canning Park Walthrough : final semster project
// user speed input
if (_root.input.text == "") {
speed = 1;
} else {
speed = _root.input.text;
//trace(speed);
}
// forward and rewind of mc
myMC1.onEnterFrame = function() {
mousePos = _root._ymouse;
cfrm = _root.myMC1._currentframe;
if (mousePos>0 && mousePos<175) {
_root.myMC1.gotoAndStop(cfrm+speed/1);
} else if (mousePos>225 && mousePos<400) {
_root.myMC1.gotoAndStop(cfrm-speed);
}
};
updateAfterEvent;
// Time
timevar = Math.round((getTimer()/1000));
// Distance
function distcount() {
distvar = Math.round(getTimer()/1000*speed/3);
}
if (mousePos>0 && mousePos<175) {
distcount();
} else if (mousePos>225 && mousePos<400) {
distcount();
} else {
//stop
}
if (cfrm==1 || cfrm==151) {
//stop
}
updateAfterEvent;
the bold part in the script denotes bug which i'm not sure how to fix. Please help, thanx in advance :) i own you.