Problem playing MC forward then backwards

hello

im trying to get this button to work, but i can’t seem to get it right. if the user rolls over AND STAYS over the button i want the movie to play all the way through. and if the user rolls over the button and rolls out before the movie hits frame 36 i want the movie to play up to frame 36 and then play backwards. and if the user rolls out after frame 36 i just want it to play backwards. TIA for any help. here’s my code:

stop();

this.onEnterFrame = function(){
if(rewind == true){ //if rewind switch is set to true play backwards
prevFrame(); // play backwards
}
}

this.onRollOver = function(){
rewind = false; //set variable that decides wether ot not to play backwards…
play(); // play this movie clip
}

this.onRollOut = function(){
while (this._currentframe < 36){
this.nextFrame();
}
rewind = true;
}

this.onRelease = function(){
getURL("##","_blank");
}

dont double post!!
check the as2 section…