[url=http://rapidshare.com/files/315654670/estrellaelastica.fla.html][/url]
http://rapidshare.com/files/315654670/estrellaelastica.fla.html
Código ActionScript :
onClipEvent (enterFrame) {
_root.positionx2 = this._x
_root.positiony2 = this._y
}
onClipEvent (load) {
defaultX = _x;
defaultY = _y;
newXpos = defaultX;
newYpos = defaultY;
ratio = 0.1;
import mx.transitions.Tween;
var myTween:Tween = new Tween(this, "_y", mx.transitions.easing.Elastic.easeOut, -80, this._y, 3, true);
var myTween:Tween = new Tween(this, "_x", mx.transitions.easing.Elastic.easeOut, 400, this._x, 3, true);
//velocidad
velocidad = 420;
}
onClipEvent (enterFrame) {
if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
xDifference = _root._xmouse-defaultX;
yDifference = _root._ymouse-defaultY;
newXpos = (_root._xmouse-xDifference/0.5);
newYpos = (_root._ymouse-yDifference/0.5);
_x += newX;
_y += newY;
} else {
this.stopDrag();
newXpos = defaultX;
newYpos = defaultY;
}
newX = (newX*friction)+((newXpos-_x)*ratio);
newY = (newY*friction)+((newYpos-_y)*ratio);
_x += newX;
_y += newY;
//rota
mousePos = {X:this._xmouse};
rotation = (mousePos.X-(Stage.width/3))/velocidad;
if (_root._xmouse>this._x) {
this._rotation += rotation;
} else {
this._rotation -= rotation;
}
}La idea es que al tocar el objeto este se comporte dando la sensación de que está colgando de una cuerda (un ligero balanceo)
gracias x adelantado
