ho fatto una prova
apri un fla nuovo
crea un clip (una palla) ed istanzialo "btn1"
poi sulla frame incolla questo codice
codice:
var titolo:Array = new Array ("", "Uno", "Due", "Tre")
this.createTextField("Titolo",100,100,20,100,20)
btn1._xscale = btn1._yscale = 20
btn1.onPress=function(){
// storicizzo
this.old_x = this._x;
this.old_y = this._y
this.old_depth = this.getDepth()
this.swapDepths(100);
this.old_rotation = this._rotation;
this._rotation = 0;
// aziono
this._xscale = 100;
this._yscale = 100;
this._x = _root._xmouse - this._width/2;
this._y = _root._ymouse - this._height/2;
this.startDrag(true);
a = this._name
b = a.substr(a.length-1,a.length)
c = Number(b)
Titolo.text = titolo[c]
}
btn1.onRelease=function(){
this._x = this.old_x;
this._y = this.old_y;
this._xscale = 20;
this._yscale = 20;
this._rotation = this.old_rotation;
this.swapDepths(this.old_depth);
stopDrag();
c=0
Titolo.text = titolo[c]
}
Vedrai che funziona
Il secondo passo è applicare un codice ricorsivo per gli N clip che funzionano da pulsanti
Quindi
copia la palla altre 2 volte ed istanziali btn2 e btn3
cambia il codice
codice:
var titolo:Array = new Array ("", "Uno", "Due", "Tre")
this.createTextField("Titolo",100,100,20,100,20)
btn1._xscale = btn1._yscale = 20
MovieClip.prototype.gestioneBTN = function(){
this.onPress=function(){
// storicizzo
this.old_x = this._x;
this.old_y = this._y
this.old_depth = this.getDepth()
this.swapDepths(100);
this.old_rotation = this._rotation;
this._rotation = 0;
// aziono
this._xscale = 100;
this._yscale = 100;
this._x = _root._xmouse - this._width/2;
this._y = _root._ymouse - this._height/2;
this.startDrag(true);
a = this._name
b = a.substr(a.length-1,a.length)
c = Number(b)
Titolo.text = titolo[c]
}
this.onRelease=function(){
this._x = this.old_x;
this._y = this.old_y;
this._xscale = 20;
this._yscale = 20;
this._rotation = this.old_rotation;
this.swapDepths(this.old_depth);
stopDrag();
c=0
Titolo.text = titolo[c]
}
}
for(I=1;I<4;I++){
this["btn"+I]._xscale=this["btn"+I]._yscale=20
this["btn"+I].gestioneBTN()
}
al posto della creazione a mano nel ciclo puoi inserire il duplicateMovieClip e dopo
assegni il prototipo di comportamento