z = true;
aperta = false;
massimox = 400;
minimox = 100;
massimoy = 350;
minimoy = 50;
for (i=1; i<=10; i++) {
//this["c"+i].foto.loadMovie("HB"+i+".jpg");
//this["b"+i].foto.loadMovie("HB"+i+".jpg");
this["c"+i]._rotation = random(100)-50;
this["c"+i]._xscale = this["c"+i]._yscale=50;
this["c"+i].onMouseDown = function() {
//trace(z);
if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
if (getTimer()-click<400) {
if (z == true) {
if (aperta == false) {
open_pic(this._name);
} else {
close_pic(this._name);
}
z = false;
} else if (z == false) {
z = true;
}
} else {
click = getTimer();
}
}
};
this["c"+i].onLoad = function() {
};
this["c"+i].onPress = function() {
posizionex = this._x;
posizioney = this._y;
_root.xv = this._x;
_root.yv = this._y;
//trace("posizione "+posizionex)
this.onEnterFrame = function() {
_root.tempo++;
calcolox = ((this._x-posizionex)*7)/tempo;
calcoloy = ((this._y-posizioney)*7)/tempo;
trace(calcolox);
_level0["c"+substring(this._name, 2, 1)].swapDepths(100);
dif = _root._xmouse-this._x;
dif2 = _root._ymouse-this._y;
this._x += dif/10;
this._y += dif2/10;
//trace(x++);
};
};
this["c"+i].onReleaseOutside = function() {
if (this._x<minimox or this._x>massimox or this._y<minimoy or this._y>massimoy) {
ritorna(this._name);
} else {
ritorna2(this._name);
}
};
this["c"+i].onRelease = function() {
if (this._x<minimox or this._x>massimox or this._y<minimoy or this._y>massimoy) {
ritorna(this._name);
} else {
ritorna2(this._name);
}
};
}
function open_pic(nome) {
aperta = true;
this[nome].swapDepths(100);
_level0.val_rot = this[nome]._rotation;
this[nome]._rotation = 0;
this.onEnterFrame = function() {
//trace("ciao")
if (this[nome]._xscale<100) {
this[nome]._xscale = this[nome]._yscale += 5;
} else {
delete this.onEnterFrame;
}
};
}
function close_pic(nome) {
aperta = false;
//trace("passato su "+nome);
this.onEnterFrame = function() {
if (this[nome]._xscale>50) {
this[nome]._xscale = this[nome]._yscale -= 5;
} else {
//trace(_level0.val_rot);
this[nome]._rotation = _level0.val_rot;
delete this.onEnterFrame;
}
};
}
function ritorna(nome) {
//trace("ok")
this[nome].onEnterFrame = function() {
diff = int(this._x-posizionex);
diff2 = int(this._y-posizioney);
this._x -= diff/10;
this._y -= diff2/10;
//trace(x++);
if (diff == 0) {
delete this.onEnterFrame;
}
};
}
function ritorna2(nome) {
_root.freno = 0;
_root.tempo = 0;
this[nome].onEnterFrame = function() {
freno += 2;
this._x += calcolox/freno;
this._y += calcoloy/freno;
if (freno>50) {
delete this.onEnterFrame;
}
};
}
prova questo
l'ultima tua frase l'ho letta 12 volte ma non ho capito niente
puoi spiegarti meglio grazie![]()

Rispondi quotando