Be a Supporter!

post insane actionscript here!

  • 347 Views
  • 2 Replies
New Topic Respond to this Topic
API
API
  • Member since: Oct. 13, 2003
  • Offline.
Forum Stats
Member
Level 22
Blank Slate
post insane actionscript here! 2004-01-03 12:42:01 Reply

put this script in a seperate layer, then, in another layer, put a movie clip named ball_mc.

var centerX = 275;
var centerY = 200;
var k = .2;
ball_mc.onPress = function() {
this.startDrag();
this.dragging = true;
};
ball_mc.onRelease = ball_mc.onReleaseOutside=function () {
this.stopDrag();
this.dragging = false;
};
onEnterFrame = function () {
if (!ball_mc.dragging) {
dx = centerX-ball_mc._x;
dy = centerY-ball_mc._y;
accX = dx*k;
accY = dy*k;
velX += accX;
velY += accY;
velX *= .9;
velY *= .9;
ball_mc._x += velX;
ball_mc._y += velY;
} else {
velX = ball_mc._x-oldX;
velY = ball_mc._y-oldY;
oldX = ball_mc._x;
oldY = ball_mc._y;
}
clear();
lineStyle(1, 0, 100);
moveTo(centerX, centerY);
lineTo(ball_mc._x, ball_mc._y);
};

calculon000
calculon000
  • Member since: Jun. 19, 2003
  • Offline.
Forum Stats
Member
Level 19
Voice Actor
Response to post insane actionscript here! 2004-01-03 13:24:22 Reply

I think I did it wrong...
I tried it and all I got was a diagonal line and the ball_mc movie clip just sittin there.

post insane actionscript here!

API
API
  • Member since: Oct. 13, 2003
  • Offline.
Forum Stats
Member
Level 22
Blank Slate
Response to post insane actionscript here! 2004-01-04 18:39:59 Reply

im sorry, when i posted the script, it didnt format right.... im so sorry! its not a scripting error.