I have an array of Sprites on stage and want to now the rectangle that bounds them. I could do a loop and check each element's getBounds() but that could be computationally expensive. Is there a better way to do it?
You could put them all inside a Sprite, and get the bounding box of that sprite.
You could spread the load for this operation over time, by maintaining two more arrays, one for pixel rows, and one for pixel columns, so for an 800x600 stage, you'd have an xBounds array of 800 elements, and a yBounds array of 600 elements.
Each element of each array would be an array of references to all sprites that have a bound that falls on that pixel (or null, if none use that column/row). So, each sprite would have two entries in each array; one for min x bound, one for max.
Any time you move, resize, rotate, or otherwise change the bounds of a sprite, you'd then have to update those lists by removing the old values of min and max from each of your two lists, and adding them in at the new positions.
This way, your overall bounds for all sprites on screen are simply the lowest and highest used indexes in each of those two arrays.
For extra speed, you would most likely also want to store the min and max values for x and y, and only change them if the sprite action would change them. So, if a sprite is placed below the minimum or above the max, you could update the value with a simple assignment to the new min or max; and if the sprite was the only element in the array for the current min column, and was moved higher, then you'd loop from the old min, up to the sprite's new position, and set the new min to the first occupied array element (and the same but opposite for the max column).
Using arrays, this solution would use a couple of kb of memory, and occasionally requires looping over part of the array. More optimally, you could replace the arrays with a "sorted list" class: probably not worth developer/maintainer time for the additional complexity, but using some form of self-balancing binary tree might add a little speed and save a bit of memory, which could matter if you had many sprites, moving often, with a large screen, a slow CPU, and little memory.
Either way, be sure to handle the case where the arrays are empty because no sprites are displayed.
var child:DisplayObject = ...
var parent:DisplayObject = new Sprite(); // should be the parent object.
var bounds:Rectangle = child.getBounds(parent)