MX Bug? Problem?

In Flash MX whenever I seem to program any random movement it never shows up when I test it or whenever I export it. The movie clips appear but they are motionless. If anyone knows what this is or how to solve it please reply. Thanx a lot

 -Drew=)

What is the code you are using to program the movement?

code would help… :slight_smile:

O.K. Here’s the code. I pasted this in the first keyframe of my action layer. This is from Kirupa’s Tutorial on random motion.

function getdistance (x, y, x1, y1) {
var run, rise;
run = x1-x;
rise = y1-y;
return (hyp(run, rise));
}
function hyp (a, b) {
return (Math.sqrt(aa+bb));
}
MovieClip.prototype.reset = function () {
var dist, norm, movie_height, movie_width;

movie_height = 150;
movie_width = 300;

speed = Math.random()4+2;
targx = Math.random()
(movie_width-_width);
targy = Math.random()*(movie_height-_height);
dist = _root.getdistance(_x, _y, targx, targy);

norm = speed/dist;
diffx = (targx-_x)*norm;
diffy = (targy-_y)*norm;
};

MovieClip.prototype.move = function () {
var cycle;

if (_root.getdistance(_x, _y, targx, targy)>speed) {x += diffx;y += diffy;
} else {x = targx;
y = targy;
if (!this.t) {
t = getTimer();
}if (getTimer()-t>cycle) {reset();
t = 0;
}
}
_x = x;
_y = y;
}

This was pasted in the movie clips I wanted to move:

onClipEvent (enterFrame) {
move();
}

I’m pretty sure something is not wrong with the code because I have copied and pasted it from tutorials after I found out some other codes didn’t work.