Make movieclip B follow x-coordinate of movieclip A

Could someone give me advice on how to do this?

This is what I want to do:

//We have movieclip A and B
--------------------**
-----------------------
-------[A]-------------

//B is moving left, want to follow A's y-coordinate.
--------------<-**---
-----------------------
-------[A]-------------

//B getting closer to A
--------------<-**---
 -----------------------
 -------[A]-------------

//A shaking off B
-------[A]-------------
-----------------------
 -<-**-----------------

//B still following the y-coordinate of A
-<-**-----[A]---------
-----------------------
 -----------------------