Multiple Selection of Units

Ok, I’ll try to explain this simply (mainly for my benefit later :} )

I am making a game where you control ships by clicking on them, and then clicking else where on the screen to move them to that position, like on Command and Conquer and Age of Empires.

How could I create a something (box) that would allow me to click and drag, so selecting multiple units on my screen, and then allowing me to move them??

I’ve only got Flash MX, so none of that there new fangled Flash MX 2004!

Thanks in advance

I’m trying to find the example I made a while back to see If I could. I got it all working but the problem was with the movement and getting the ‘units’ to check for each other so they don’t all end at the same point (and on top of each other). If I find the fla i’ll post it, or make a new one If I find the time. sorry, but perhaps this bump will find someone else who can help more than me at this pont.

You could have a box that registers in it’s top-left corner, and then put this in it:


onClipEvent(load){
	hitX = 0;
	hitY = 0;
	hit = false;
}
onClipEvent(mouseDown){
	dragging = true;
	if(hit == false){
		hit = true;
		hitX = _root._xmouse;
		hitY = _root._ymouse;
	}
}
}
onClipEvent(mouseUp){
	dragging = false;
	hit = false;
}
onClipEvent(mouseMove){
	if(dragging){
		_x = hitX;
		_y = hitY;
		a = _root._xmouse - _x;
		b = _root._ymouse - _y;
		_width = a;
		_height = b;
	}
}
onClipEvent(enterFrame){
	if(hit){
		_visible = true;
	}else{
		_visible = false;
	}
}

I just made that up right now so it might not work

EDIT: Nevermind, that one isn’t very good; use this one I just made:


onClipEvent(load){
 hitX = 0;
 hitY = 0;
 hit = false;
 _root.createEmptyMovieClip("Line", 100000);
}
onClipEvent(mouseDown){
 dragging = true;
 if(hit == false){
  hit = true;
  hitX = _root._xmouse;
  hitY = _root._ymouse;
 }
}
onClipEvent(mouseUp){
 dragging = false;
 hit = false;
 _root.Line.clear();
}
onClipEvent(mouseMove){
 if(dragging){
  x = hitX;
  y = hitY;
  a = _root._xmouse - x;
  b = _root._ymouse - y;
  _root.Line.clear();
  _root.Line.beginFill(0xFFCC00, 50);
  _root.Line.moveTo(x, y);
  _root.Line.lineStyle(1, 0x000000, 100);
  _root.Line.lineTo(x + a, y);
  _root.Line.lineTo(x + a, y + b);
  _root.Line.lineTo(x, y + b);
  _root.Line.lineTo(x, y);
  _root.Line.endFill();
 }
}

Thankyou!

This has saved me about 4 weeks more work!