while the mouse is over my button I want a function to be exicuted untill it is false. how can i do this?
unfortunately, unlike director, flash has no on mousewithin event. So, in order to emulate that, you would need to combine onEnterFrame with onRollOver, onDragOver, onRollOut and onDragOut.
target.onRollOver = target.onDragOver = function(){
this.onEnterFrame = function(){
this.customMouseWithin();
}
}
target.onRollOut = target.onDragOut = function(){
delete this.onEnterFrame
}
be weary of this interfering with your own enterFrame though (if you have one for target already), you may need to set up a surrogate.
I would go with senocular`s method too but you could also do this with hitTest()
button instance name btn
mc instance name mc1
checkhit = function () {
if (!btn.hitTest(_xmouse, _ymouse)) {
delete mc1.onEnterFrame;
} else {
mc1.onEnterFrame = moveup;
}
};
function moveup() {
this._y -= 1;
}
myInterval = setInterval(checkhit, 50);
you would have to clearInterval at some point.