문제

can we get all the elements and all the descendants of those elements in a

VBox

? lets say i have Vobx, in which a grid is added.. and in grid there are many texinput controls.. i want to access all the descendants which are

Grid,GridRow,GridItem,TextInput

.. how to do that ?

도움이 되었습니까?

해결책

You'll have to write a recursive function that traverses the hierarchy of components. There is no built-in method to access children below the first level of a container.

Something like:

function traceDisplayObject(object:DisplayObject):void {
  trace("Object: " + object);

  if (object is Container) {
    var container:Container = Container(object);
    var numChildren:uint = container.numChildren;

    for (var i:uint = 0; i<numChildren; i++) {
      traceDisplayObject(container.getChildAt(i));
    }
  }
}

traceDisplayObject(myVBox);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top