About Spark containers

Spark includes the following containers:

For more information on the Application container, see Application containers.

Interchangeable layouts

Most Spark containers support interchangeable layouts. That means you can set the layout of a container to any of the supported layout types, such as basic, horizontal, vertical, or tiled layout. You can also define a custom layout.

Note: Some Spark containers, such as HGroup, VGroup, and TileGroup, have a predefined layout that you cannot change.

Skinning

To improve performance and minimize application size, some Spark containers do not support skinning. Use the Group and DataGroup containers to manage child layout. Use SkinnableContainer and SkinnableDataContainer to manage child layout and to support custom skins.

Visual child components

The Group and SkinnableContainer classes can take any visual components as children. Visual components implement the IVisualElement interface, and include subclasses of the UIComponent class and the GraphicElement class.

The UIComponent class is the base class of all Flex components. Therefore, you can use any Flex component as a child of the Group and SkinnableContainer class.

The GraphicElement class is the base class for the Flex drawing classes, such as the Ellipse, Line, and Rect classes. Therefore, you can use subclass of the GraphicElement class as a child of the Group and SkinnableContainer class.

The DataGroup and SkinnableDataContainer classes take as children visual components that implement the IVisualElement interface and are subclasses of DisplayObject. This includes subclasses of the UIComponent class.

Data items

However, the DataGroup and SkinnableDataContainer containers are optimized to hold data items. Data items can be simple data items such as String and Number objects, and more complicated data items such as Object and XMLNode objects. Therefore, while these containers can hold visual children, use Group and SkinnableContainer for children that are visual components.

Main characteristics of Spark containers

The following table lists the main characteristics of the Spark containers:

Container

Children

Skinnable

Scrollable

Creation policy

Primary use

Group (including HGroup, VGroup, and TileGroup)

IVisualElement

No

As a child of Scroller

All

Lay out visual children.

DataGroup

Data Item IVisualElement and DisplayObject

No

As a child of Scroller

All

Render and lay out data items.

SkinnableContainer

IVisualElement

Yes

By skinning

Selectable

Lay out visual children in a skinnable container.

SkinnablePopUpContainer

IVisualElement

Yes

By skinning

Selectable

Lay out visual children in a skinnable container opened as a pop up window.

SkinnableDataContainer

Data item IVisualElement and DisplayObject

Yes

By skinning

Selectable

Render and lay out data items in a skinnable container.

BorderContainer

IVisualElement

Yes

No

Selectable

Lay out visual children in a basic container that includes a border.

Form

IVisualElement

Yes

Yes

Selectable

Lay out FormItem and FormHeading children similar to an HTML form.

NavigatorContent

IVisualElement

Yes

By skinning

Inherited from parent container

Subclass of SkinnableContainer that can be used as the child of an MX navigator container.

Panel

IVisualElement

Yes

By skinning

Selectable

Subclass of SkinnableContainer that adds a title bar and other visual elements to the container.

TitleWindow

IVisualElement

Yes

By skinning

Selectable

Subclass of Panel that is optimized for use as a pop-up window.

For information on skinning, see Spark Skinning.

Creation policy

Container creation policy determines how and when children of containers are created. For information on creation policy, see About the creation policy.