Controle multiple movies with a for loop: need help!

Hi, I have 18 movie clips on the _root timeline called (1,2,3…18) that I want to control at the same time and with the same instructions. I want them all to have the same behaviour. I’m trying to avoid typing out the same thing for 18 clips if at all possible!

This is what I’ve got but it isn’t working. The srcipt works okay if it’s not in the for loop.

  xspeed = 1;
  yspeed = 2;
  for(movie = 0,movie<19,movie++){
  	[movie].onEnterFrame = function(){
  		[movie].onRollOver = function() {;
  		[movie].onRollOut = function(){
  		[movie]._x += [movie].xspeed;
  		if ([movie]._x < 140 || [movie]._x > 610){
  			[movie].xspeed *= -1;
  		[movie]._y += [movie].yspeed;
  		if([movie]._y<140 || [movie]._y>391){
  			[movie].yspeed *= -1;

I’m trying to move them and use them as buttons at the same time. Is that possible or have I made some probably simple muck up??

Any advice/help very much appreciated! Cheers,