Repel away from mouse

I’ve been trying to come up with a script that will make mc’s repel away from the mouse. Here is an example of exactly what I’m looking for:

http://www.antstudio-bcn.com/

and here is the beginning of a script that I’ve modified from Kirupa to try and achieve this effect, but it looks terrible.


this.createEmptyMovieClip("dot", -10) ;
dot.lineStyle (10, 0, 100) ;
dot.lineTo (.45, .15) ;
dot._visible = false ;

count=0;
k = .09;
minDist = 50;
damp = .9;

function repelMouse() {
    
    var dx = _xmouse - this._x;
    var dy = _ymouse - this._y;
    var d = Math.sqrt(dx*dx + dy*dy);
    
    if (d <= minDist) {
        this._x -= dx / d * minDist * k;
        this._y -= dy / d * minDist * k;
    }   
   
       if (d > minDist + 5){
        this.vx = (this.myX - this._x) * .5;
           this.vy = (this.myY - this._y) * .5;
           this._x += this.vx;
           this._y += this.vy;
    }
}

for (var i=0; i < 10; i++) {
    for (var j=0; j < 10; j++) {
        count++ ;
        var d = dot.duplicateMovieClip ("d"+count, count) ;
        d._x = d.myX = 30 * i ;
        d._y = d.myY = 30 * j ;
        d.onEnterFrame = repelMouse;
    }
}

the dots seem so jumpy. there has to be a better way to do this. I’ve looked online, and everything i found was ridiculously complicated. any help would be greatly appreciated.