ViewStack navigator container

A ViewStack navigator container is made up of a collection of child containers that are stacked on top of each other, with only one container visible, or active, at a time. The ViewStack container does not define a built-in mechanism for users to switch the currently active container; you must use a LinkBar, TabBar, ButtonBar, or ToggleButtonBar control or build the logic yourself in ActionScript to let users change the currently active child. For example, you can define a set of Button controls that switch among the child containers.

The following image shows the stacked child containers in a ViewStack container:


ViewStack container

On the left, you see a ViewStack container with the first child active. The index of a child in a ViewStack container is numbered from 0 to n - 1, where n is the number of child containers. The container on the right is a ViewStack container with the second child container active.

The ViewStack container has the following default sizing characteristics:

Property

Default value

Default size

The width and height of the initially active child.

Container resizing rules

ViewStack containers are sized only once to fit the size of the first child container by default. They do not resize when you navigate to other child containers by default. To force ViewStack containers to resize when you navigate to a different child container, set the resizeToContent property to true.

Child sizing rules

Children are sized to their default size. The child is clipped if it is larger than the ViewStack container. If the child is smaller than the ViewStack container, it is aligned to the upper-left corner of the ViewStack container.

Default padding

0 pixels for top, bottom, left, and right values.

For complete reference information, see ViewStack in Adobe Flex 2 Language Reference.

Subtopics

Creating a ViewStack container
Sizing the children of a ViewStack container
Applying behaviors to a ViewStack container

Flex 2.01

Take a survey