Mi sono permesso di riorganizzare l'azione che ho trovato nel fotogramma 2 del livello 6. Ora non avrai più problemi di percorsi e lo puoi caricare dove vuoi senza preoccuparti di annotare i nomi dei vari movieclip.
codice:
MovieClip.prototype.menuElement = function(v, x1, y1, x2, y2) {
this.vel = v;
this.onEnterFrame = function() {
if (this.hitTest(_root._xmouse, _root._ymouse)) {
this.x = x1;
this.y = y1;
} else {
this.x = x2;
this.y = y2;
}
var a = Math.abs(this.x-this._x);
var b = Math.abs(this.y-this._y);
if (a<=1 && b<=1) {
this._x = this.x;
this._y = this.y;
} else {
this._x += (Math.round(this.x-this._x))/this.vel;
this._y += (Math.round(this.y-this._y))/this.vel;
}
};
};
mc_1foto.menuElement(5, 50, 18, 112, 18);
Chiaramente una volta che il prototipo è stato creato puoi assegnare il comportamento a tutti i movieclip che ti pare (come nell'ultimo rigo di codice qui sopra) e saranno tutti indipendenti.
Funziona anche con Flash 6 e AS 1.0.
Ciao.