Salve a tutti,
ho una funzione che mi muove un movieclip sullo stage, quando arriva a delle coordinate di destinazione, cancello l'onEnterFrame come ho sempre fatto col comando delete this.onenterFrame(), ma il problema è che il codice viene letto comunque e ricostro un problema di ricorsione....
dove sbaglio?
codice:
function moveMenuIn() {
var destY:Number = 136;
var destX:Number = 372;
var destR:Number = -10;
targetMenu_mc.onEnterFrame = function() {
//_y += (targety-_y)*friction;
myXspeed = ((_x-destX)/a+myXspeed)/d;
myYspeed = ((_y-destY)/a+myYspeed)/d;
myRspeed = ((_rotation-destR)/a+myRspeed)/d;
_y += -myYspeed;
_x += -myXspeed;
_rotation += -myRspeed;
if (Math.round(_x) == destX && Math.round(_y) == destY) {
trace("MENU: destinazione raggiunta!");
delete this.onEnterFrame();
}
};
}
grazie a tutti