I would use a Rectangle for that. Let’s assume you are making an RTS game and want to make it possible to select multiple units by drawing a rectangle around them, that’s a fairly classic use of selection areas. I’d recommend doing:
selectionArea:Rectangle, a permanent variable that you initialize when you initialize the game.
in the function that handles MouseEvent.MOUSE_DOWN events add:
selectionArea.x = screenToMapX(mouseX);
selectionArea.y = screenToMapY(mouseY);
where screenToMapZ is a function that converts a coordinate Z = X or Y on the screen to the corresponding position on the game map, based on where the view currently is.
In the function that handles MOUSE_UP events add:
temp = screenToMap(mouseX) - selectionArea.x;
if (temp > 0) selectionArea.width = temp;
selectionArea.x += temp;
selectionArea.width = -temp;
//same with height.
if (selectionArea.width >= minimalSelectionWidth && selectionArea.height >= minimalSelectionHeight)
// Reset the selection area by making its x, y, width and height variables 0.
where selectUnitsIn is a function that loops over all units on the map and for each unit:
Checks if it is controlled by the player and located inside the selection rectangle and if so, selects it.
Hope this helps.