Non il massimo in eleganza, ma dovrebbe funzionare:
Codice PHP:
this.attachMovie("but1","pippo",2);
this.attachMovie("but2","but2",1);
var startX:Number = 100;
var startY:Number = 100;
this.pippo._x=startX;
this.pippo._y=startY;
this.but2._x=200;
this.but2._y=200;
pippo.onPress = function (){
this.startDrag();
if(!_root.hittato){
_root.attachMovie("but1","but1Doppler",3);
_root.but1Doppler._x=startX;
_root.but1Doppler._y=startY;
_root.but1Doppler.onPress = function (){
this.startDrag();
}
_root.but1Doppler.onRelease = function (){
stopDrag();
}
}
}
pippo.onRelease = function (){
stopDrag();
if (!this.hitTest(_root.but2)) {
this._x=startX;
this._y=startY;
}else{
_root.hittato=true;
}
}