A Container in Flex is one that controls the layout characteristics of child components and which extends the Container base Class like the famous Panel,Canvas,ViewStack,TabNavigator,…
Container contains childrens or Sub Components or Sub Containers[Container in a Container], and so on.Childrens/child components in a Container are all are created using the creationPolicy setting of that Container.In case of sub containers, outer Containers are created before the inner one’s.And creation can be altered by setting the creationPolicy.
So now we know some basics of Container its time for the Topic.
We can manage the child components of a Container by using its predefined methods,like below..
1.Container.getChildren() – returns an Array of child components.
2.Container.getChildAt(index:int) – returns an instance of the DisplayObject at that creation index,which we can cast to required.
3.Container.removeChildAt(index:int) – removes child at that creation index
4.Container.removeAllChildren() – as the name specifies
In the below download code i have implemented all these methods with a Panel.Enjoy the Post.