Here's a rewrite of your code that includes rotation in the direction of movement.

I also changed the method of detecting if you've reached your destination.

code:

acceleration = 10;

newpos = function ()

{

ranx = Math.round((Math.random()*250));

rany = Math.round((Math.random()*250));

};

newpos();

this.onEnterFrame = function()

{

// figure direction of movement, relative to current position

var dx = ranx-this._x;

var dy = ranx-this._y;

// figure angle in radians

var ar = Math.atan2(dy,dx);

// convert to rotation in degrees

this._rotation = ar*180/Math.PI;

this._x += dx/acceleration;

this._y += dy/acceleration;

if (Math.abs(dx) < .5 || Math.abs(dy) < .5) {

newpos();

}

};