The most realistic way is using boids algorithm. There is an example for that in forum. Alternatively simple hack would do the trick:
I love the example CAPX you showed. It is exactly what I was looking for! Except for one problem. The code you provided does not work with instances of the same object. If you know a way to make this work with instances of the same object, I would be thrilled!
PS I tried using Boids flocking algorithm. But it did not produce the type of behavior that I wanted.
PPS Sorry for the response being so late.