I'm trying to get my code working so effectively the playhead moves backwards for a certain length of time (20 frames, 1 frame every 33 milliseconds). The setInterval function works when not inside the WHILE but I need it to run 20 times and then use the clearInterval function to stop it. I can't seem to figure out how to solve it. Currently it outputs 1 through to 20 and then "clear interval". Can someone please give me a hand? here is the code which is inside an onRelease button holder. Thanks to anyone with input.

var myInterval = setInterval(slow, 33);
var counter = 0
while (counter < 20) {


function slow (){
trace("slow function");
trace("clear interval");