How to move object and fade it?

I’ve gotten this code from another tutorial site but trying to modify it so I can apply it to my other flash movies.

Firstly what this does is it moves the object around 300 x 300 document in random coordinates. But what I want it to do is make it transparent as it decelerates or have it’s alpha go down to 0 as it nears the destination. And when it gets a new destination it’s alpha resets back to 100 again to repeat the process. Any help will be greatly appreciated!


 onClipEvent (enterFrame) {
 	currentlocx = this._x;
 	currentlocy = this._y;
 	differencex = newX - currentlocx;
 	differencey = newY- currentlocy;
 	accelx = differencex/accelFactor;
 	accely = differencey/accelFactor;
 	this._x = this._x + accelx;
 	this._y = this._y + accely;
 	if (Math.round(this._y) == Math.round(newY) && Math.round(this._x) == Math.round(newX) ) {
 		newX = Math.round(Math.random()*300);
 		newY = Math.round(Math.random()*300);
 		accelFactor = Math.ceil(Math.random()*4) + 2;
 	}
 }
 onClipEvent (load) {
 	newX = Math.round(Math.random()*300);
 	newY = Math.round(Math.random()*300);
 	accelFactor = Math.ceil(Math.random()*4) + 2;
 }