setInterval for on(rollOver)

This has probably been answered before but I couldn’t seem to find it. (I am fairly new to this site and FlashMX)

I have up and down buttons controlling the ._y value of an adjacent MClip. At the (for the up arrow) moment I have:
on(rollOver){
myMovieClip._y -= 5;
}
this works fine but I need it to continuously scroll while the mouse is over (or Press if need be).
I think it is setInterval that I need for this but I can’t remember how to do it.

Can someone help with this?

Thanks in advance. :thumb:

on(rollOver){
myMovieClip.onEnterFrame = function(){
this._y -= 5;
}
}
on(rollOut){
myMovieClip.onEnterFrame = undefined;
}

this is assuming u are applying the events to the button directly

Thanks for that. Worked a treat. Exactly what I was after.

Can it be done with setInterval too though?

Yes:
[AS]
on(rollOver){
if(!this.intervalID){
this.intervalID = setInterval(“move”, 30);
}
}
move = function(){
this.myMovieClip._y -= 5;
}

on(rollOut){
clearInterval(this.intervalID);
this.intervalID = 0;
}

[/AS]

SHO