dai al rettango come nome di istanza riquadro quindi questo è il codice da associare ai singoli pulsanti:
codice:
mc1.onRollOver = function() {
clearInterval(a);
pos = this._x;
delete this.onEnterFrame;
riquadro.onEnterFrame = function() {
this._x = this._x+(pos-this._x)/7;
if (pos == Math.round(this._x)) {
this._x = pos;
delete this.onEnterFrame;
}
};
};
mc1.onRollOut = function() {
a = setInterval(tuttoComePrima, 2000);
};
mc1.onRelease = function(){
_root.menuCliccato = this;
}
mentre questa è la funzione che ti porta il riquadro sul pulsante premuto in precedenza:
codice:
function tuttoComePrima() {
pos = _root.menuCliccato._x;
larg = _root.menuCliccato._width;
delete riquadro.onEnterFrame;
riquadro.onEnterFrame = function(){
this._x = this._x+(pos-this._x)/7;
if (pos == Math.round(this._x)) {
this._x = pos;
delete this.onEnterFrame;
}
};
clearInterval(a);
}
_root.menuCliccato = mc1;
tuttoComePrima();