i was bored so i decided to make an AS topic about somthing, but then i couldnt be bothered to explain the code so i decided to make a foss XD.
this is a toally api string that will follow the mouse its pretty cool try it out =P
var hyp:Number = 20;
// change this number to change the length of the string
var speed:Number = 15;
/* change this number to set the "gravity" put it to 0 and you can make somthing like string avoider!*/
_root.createEmptyMovieClip("point1", _root.getNextHighestDepth());
point1.moveTo(_root._xmouse, _root._ymouse);
_root.createEmptyMovieClip("point2", _root.getNextHighestDepth());
point2.moveTo(_root._xmouse, _root._ymouse);
_root.createEmptyMovieClip("point3", _root.getNextHighestDepth());
point3.moveTo(_root._xmouse, _root._ymouse);
_root.createEmptyMovieClip("point4", _root.getNextHighestDepth());
point4.moveTo(_root._xmouse, _root._ymouse);
_root.createEmptyMovieClip("point5", _root.getNextHighestDepth());
point5.moveTo(_root._xmouse, _root._ymouse);
_root.createEmptyMovieClip("point6", _root.getNextHighestDepth());
point6.moveTo(_root._xmouse, _root._ymouse);
_root.createEmptyMovieClip("point7", _root.getNextHighestDepth());
point7.moveTo(_root._xmouse, _root._ymouse);
_root.createEmptyMovieClip("point8", _root.getNextHighestDepth());
point8.moveTo(_root._xmouse, _root._ymouse);
_root.createEmptyMovieClip("point9", _root.getNextHighestDepth());
point9.moveTo(_root._xmouse, _root._ymouse);
_root.createEmptyMovieClip("point10", _root.getNextHighestDepth());
point10.moveTo(_root._xmouse, _root._ymouse);
_root.onEnterFrame = function() {
_root.clear();
point1._x = _root._xmouse;
point1._y = _root._ymouse;
Mouse.hide();
point2._y += speed;
point3._y += speed;
point4._y += speed;
point5._y += speed;
point6._y += speed;
point7._y += speed;
point8._y += speed;
point9._y += speed;
point10._y += speed;
_root.createEmptyMovieClip("line", 1);
lineStyle(5, 0x009900, 100);
angle = Math.atan2(point2._y-point1._y, point2._x-point1._x);
point2._x = point1._x+(Math.cos(angle)*hyp);
point2._y = point1._y+(Math.sin(angle)*hyp);
angle1 = Math.atan2(point3._y-point2._y, point3._x-point2._x);
point3._x = point2._x+(Math.cos(angle1)*hyp);
point3._y = point2._y+(Math.sin(angle1)*hyp);
angle2 = Math.atan2(point4._y-point3._y, point4._x-point3._x);
point4._x = point3._x+(Math.cos(angle2)*hyp);
point4._y = point3._y+(Math.sin(angle2)*hyp);
angle3 = Math.atan2(point5._y-point4._y, point5._x-point4._x);
point5._x = point4._x+(Math.cos(angle3)*hyp);
point5._y = point4._y+(Math.sin(angle3)*hyp);
angle4 = Math.atan2(point6._y-point5._y, point6._x-point5._x);
point6._x = point5._x+(Math.cos(angle4)*hyp);
point6._y = point5._y+(Math.sin(angle4)*hyp);
angle5 = Math.atan2(point7._y-point6._y, point7._x-point6._x);
point7._x = point6._x+(Math.cos(angle5)*hyp);
point7._y = point6._y+(Math.sin(angle5)*hyp);
angle6 = Math.atan2(point8._y-point7._y, point8._x-point7._x);
point8._x = point7._x+(Math.cos(angle6)*hyp);
point8._y = point7._y+(Math.sin(angle6)*hyp);
angle7 = Math.atan2(point9._y-point8._y, point9._x-point8._x);
point9._x = point8._x+(Math.cos(angle7)*hyp);
point9._y = point8._y+(Math.sin(angle7)*hyp);
angle8 = Math.atan2(point10._y-point9._y, point10._x-point9._x);
point10._x = point9._x+(Math.cos(angle8)*hyp);
point10._y = point9._y+(Math.sin(angle8)*hyp);
moveTo(point1._x, point1._y);
lineTo(point2._x, point2._y);
lineTo(point3._x, point3._y);
lineTo(point4._x, point4._y);
lineTo(point4._x, point4._y);
lineTo(point5._x, point5._y);
lineTo(point6._x, point6._y);
lineTo(point7._x, point7._y);
lineTo(point8._x, point8._y);
lineTo(point9._x, point9._y);
lineTo(point10._x, point10._y);
};
you can find a sample on the experiments page of my site its called "kinematics examle" (click my sig)
=O