Frame 1
theNumber = 1;
theX = _root._xmouse;
theY = _root._ymouse;
_global.totalBalls = 7;
_global.dragging = false;
_global.dragBall = 1;
a = 1;
while (a < totalBalls) {
attachMovie("ball", "ball" + theNumber, theNumber, {_x:(a * 60) + 70, _y:300, XDIF:_root._xmouse - theX, YDIF:_root._ymouse - theY, idNumber:theNumber});
theNumber++;
if (theNumber == totalBalls) {
theNumber = 1;
}
a++;
}
onEnterFrame = function () {
Mouse.show();
if (_global.dragging == true) {
_root["ball" + _global.dragBall]._x = _root._xmouse;
_root["ball" + _global.dragBall]._y = _root._ymouse;
_root["ball" + _global.dragBall].XDIF = _root._xmouse - theX;
_root["ball" + _global.dragBall].YDIF = _root._ymouse - theY;
Mouse.hide();
i = 1;
while (i < totalBalls) {
if (i != _global.dragBall) {
_root["ball" + i].faceMC.gotoAndStop(3);
b = _root["ball" + i]._x - _root["ball" + _global.dragBall]._x;
c = _root["ball" + i]._y - _root["ball" + _global.dragBall]._y;
radians = Math.atan2(c, b);
angle = (radians / Math.PI) * 180;
_root["ball" + i].faceMC.eyeL._rotation = angle;
_root["ball" + i].faceMC.eyeR._rotation = angle;
}
i++;
}
}
theX = _root._xmouse;
theY = _root._ymouse;
};
onMouseDown = function () {
i = 1;
while (i < totalBalls) {
a = _root._xmouse - _root["ball" + i]._x;
b = _root._ymouse - _root["ball" + i]._y;
a = a * a;
b = b * b;
c = a + b;
_root["ball" + i].faceMC.gotoAndStop(1);
if (Math.sqrt(c) < 30) {
_global.dragBall = i;
_global.dragging = true;
_root["ball" + i].faceMC.gotoAndStop(2);
}
i++;
}
};
onMouseUp = function () {
if (_global.dragging == true) {
_global.dragging = false;
_root["ball" + _global.dragBall].XDIF = _root._xmouse - theX;
_root["ball" + _global.dragBall].YDIF = _root._ymouse - theY;
_root["ball" + _global.dragBall]._x = _root._xmouse;
_root["ball" + _global.dragBall]._y = _root._ymouse;
i = 1;
while (i < totalBalls) {
_root["ball" + i].faceMC.gotoAndStop(1);
i++;
}
}
};
Symbol 10 MovieClip Frame 1
stop();
Symbol 13 MovieClip [ball] Frame 1
gravity = 1;
this.gotoAndStop(idNumber);
onEnterFrame = function () {
this._x = this._x + this.XDIF;
this._y = this._y + this.YDIF;
theHands._x = -(XDIF * 2);
theHands._y = -(YDIF * 2);
YDIF = YDIF + gravity;
XDIF = XDIF - (XDIF / 40);
if (YDIF > 20) {
YDIF = 20;
}
if (XDIF > 20) {
XDIF = 20;
}
if (this._x < 25) {
this.XDIF = -this.XDIF;
this._x = 25;
}
if (this._x > 525) {
this.XDIF = -this.XDIF;
this._x = 525;
}
if (this._y < 25) {
this.YDIF = -this.YDIF;
this._y = 25;
}
if (this._y > 375) {
this.YDIF = -this.YDIF;
this._y = 375;
YDIF = YDIF / 2;
}
i = 1;
while (i < totalBalls) {
if (idNumber != i) {
a = this._x - _root["ball" + i]._x;
b = this._y - _root["ball" + i]._y;
a = a * a;
b = b * b;
c = a + b;
if (Math.sqrt(c) < 50) {
this._x = preX;
this._y = preY;
XDIF = (-XDIF) - _root["ball" + i].XDIF;
YDIF = (-YDIF) - _root["ball" + i].YDIF;
_root["ball" + i].XDIF = (-_root["ball" + i].XDIF) - XDIF;
_root["ball" + i].YDIF = (-_root["ball" + i].YDIF) - YDIF;
faceMC.gotoAndPlay(4);
_root["ball" + i].faceMC.gotoAndPlay(4);
}
}
i++;
}
preX = this._x;
preY = this._y;
};
Symbol 20 MovieClip Frame 31
stop();