Есть статический вектор на 300 элементов, нужно перестраховаться на случай его переполнения.

Код AS3:
/**
* Searches target display object and its linear algorithm for symbol named (oname).
* if ignoreDependancy is true, it will ignore IndependedDisplay property on symbols and will go deeper
*
* @param owner The main container
* @param name The name of the object
* @param ignoreIndependency The flag which includes verification of the existence of properties IndependedDisplay
* @return The first matching object in the tree with the given name
*
*/
public static function getChildByNameDeep( owner: DisplayObjectContainer, name: String, ignoreIndependency:Boolean = false ): DisplayObject
{
trace("Вход");
var first:MovieClip = new MovieClip();
first.name = 'null';
first.addChild(owner);
if( owner == null ) return null;//Проверяем основной контейнер на пустоту
var stackIdx:Vector.<uint> = new Vector.<uint>(300, true);
var lastElVec:uint = 0;//указатель на последний элемент вектора
var currContainer:DisplayObject = owner;
var curChildIndex:int = 0;//счетчик углубленности в контейнере
trace("curr=", currContainer.name );
do
{
// Имитация захода внутрь
if( currContainer is DisplayObjectContainer )
{
trace( "currContainer is DisplayObjectContainer, curChildIndex="+curChildIndex );
if( !ignoreIndependency && currContainer.hasOwnProperty( "IndependedDisplay")&& currContainer["IndependedDisplay"] == true )
{
}
else if( curChildIndex < (currContainer as DisplayObjectContainer).numChildren )
{
trace( "curChildIndex="+curChildIndex+"Углубленность="+(currContainer as DisplayObjectContainer).numChildren);
lastElVec++;//перетаскиваем указатель Вправо
stackIdx[lastElVec] = curChildIndex;
trace("размер массива",stackIdx);
currContainer = ( currContainer as DisplayObjectContainer ).getChildAt( curChildIndex );
curChildIndex = 0;
trace( "идем внутрь", currContainer.name );
continue;
}
}
// проверка на доститжение результата
trace( "проверка на доститжение результата" );
if( currContainer.name == name ) return currContainer;
// Идем наверх
// выше некуда
if( lastElVec > stackIdx.length-1 )
return null;
// выше есть куда
trace("выше есть куда до:",curChildIndex);
curChildIndex = stackIdx[lastElVec];
lastElVec--;
curChildIndex++;
trace("выше есть куда после:",curChildIndex);
currContainer = currContainer.parent;//возвращаемся к родителю
// Если мы поднялись до уровня вызова
} while ( currContainer != first );
return null;
}//getChildByNameDeep[/left]