Using SlideShowLayout in Feathers containers (Starling version)
SlideShowLayout class may be used by containers that support layout, such as
ScrollContainer, to display one item at a time and scroll page by page.
First, let's create a slide show layout and pass it to a
var layout:SlideShowLayout = new SlideShowLayout(); var container:ScrollContainer = new ScrollContainer(); container.layout = layout; this.addChild( container );
There are a number of simple properties that may be used to affect positioning and sizing of items in the layout. Let's look at some of the most common.
SlideShowLayout positions items horizontally, from left to right, by default. Alternatively, you can tell the layout to position items vertically, from top to bottom, instead:
layout.direction = Direction.VERTICAL;
direction property may be set to
The padding is the minimum space around the edges of each item in container. Let's set the
padding property to
layout.padding = 12;
If needed, the padding on each side of the container may be set separately. Below, we set the
paddingBottom properties to
10 pixels, and we set the
layout.paddingTop = 10; layout.paddingRight = 15; layout.paddingBottom = 10; layout.paddingLeft = 15;
We can align each item within its own page using the
verticalAlign properties. Alignment only applies when the item does not fill the entire width or height of the page.
Let's adjust the alignments so that the content will be aligned to the top and left:
layout.horizontalAlign = HorizontalAlign.LEFT; layout.verticalAlign = VerticalAlign.TOP;