MultiColumnGridLayout
public class
feathers.layout.MultiColumnGridLayout
Description
Positions items in rows following a grid with a specific number of
columns, defaulting to 12
columns. Automatically flows from
row to row.
Beta Layout: This is a new layout, and its APIs may need some changes between now and the next version of Feathers to account for overlooked requirements or other issues. Upgrading to future versions of Feathers may involve manual changes to your code that uses this layout. The Feathers deprecation policy will not go into effect until this layout's status is upgraded from beta to stable.
See also:
http://wiki.starling-framework.org/feathers/multi-column-grid-layout
feathers.layout.MultiColumnGridLayoutData
API overview
Constructor
MultiColumnGridLayout
()
Constructor.
Attributes
Public attributes
columnCount: Number |
The number of columns in the grid |
columnGap: Number |
The size, in pixels, of the gap between columns |
rowGap: Number |
The size, in pixels, of the gap between rows |
Functions
Public functions
getScrollPositionForIndex ( index: Number , items: Vector.<DisplayObject> , x: Number , y: Number , width: Number , height: Number ): Point |
Using the item dimensions, calculates a scroll position that will ensure that the item at a given index will be visible within the specified bounds |
layout ( items: Vector.<DisplayObject> , viewPortBounds: ViewPortBounds = null , result: LayoutBoundsResult = null ): LayoutBoundsResult |
Positions (and possibly resizes) the supplied items within the optional bounds argument |
Constructor
MultiColumnGridLayout ()
Constructor.
Attributes
Functions
addEventListener
(
type: String
,
listener: Function
): Void
Inherited from EventDispatcher
Registers an event listener at a certain object.
Parameters
type: String | |
listener: Function |
dispatchEvent
(
event: Event
): Void
Inherited from EventDispatcher
Dispatches an event to all objects that have registered listeners for its type. If an event with enabled 'bubble' property is dispatched to a display object, it will travel up along the line of parents, until it either hits the root object or someone stops its propagation manually.
Parameters
event: Event |
dispatchEventWith
(
type: String
,
bubbles: Boolean
= false
,
data: Object
= null
): Void
Inherited from EventDispatcher
Dispatches an event with the given parameters to all objects that have registered listeners for the given type. The method uses an internal pool of event objects to avoid allocations.
Parameters
type: String | |
bubbles: Boolean = false | |
data: Object = null |
getFullTypeName
(): String
Inherited from Object
native
Gets the fully qualified type name of the Object. The fully qualified type name includes the package of the type.
Returns
String | fully qualified type name of the Object. |
getScrollPositionForIndex ( index: Number , items: Vector.<DisplayObject> , x: Number , y: Number , width: Number , height: Number ): Point
Using the item dimensions, calculates a scroll position that will ensure that the item at a given index will be visible within the specified bounds.
Parameters
index: Number | |
items: Vector.<DisplayObject> | |
x: Number | |
y: Number | |
width: Number | |
height: Number |
getType
(): Type
Inherited from Object
native
Gets the Type that describes the Object.
Returns
Type | The Type that describes the object. |
getTypeName
(): String
Inherited from Object
native
Gets the type name of the Object.
Returns
String | type name of the Object. |
hasEventListener
(
type: String
): Boolean
Inherited from EventDispatcher
Returns if there are listeners registered for a certain event type.
Parameters
type: String |
layout ( items: Vector.<DisplayObject> , viewPortBounds: ViewPortBounds = null , result: LayoutBoundsResult = null ): LayoutBoundsResult
Positions (and possibly resizes) the supplied items within the optional bounds argument. If no bounds are specified, the layout algorithm will assume that the bounds start a 0,0 and have unbounded dimensions. Returns the actual bounds of the content, which may be different than the specified bounds.
Note: The items are not absolutely restricted to appear only within the bounds. The bounds can affect positioning, but the algorithm may very well ignore them completely.
If a layout implementation needs to access accurate width
and height
values from items that are of type
IFeathersControl
, it must call validate()
manually. For performance reasons, the container that is the parent
of the items will not call validate()
before passing the
items to a layout implementation. Meeting this requirement may be as
simple as looping through the items at the beginning of
layout()
and validating all items that are Feathers UI
controls:
const itemCount:int = items.length;
for(var i:int = 0; i < itemCount; i++)
{
var item:IFeathersControl = items[i] as IFeathersControl;
if(item)
{
item.validate();
}
}
See also:
feathers.core.IFeathersControl#validate()
Parameters
items: Vector.<DisplayObject> | |
viewPortBounds: ViewPortBounds = null | |
result: LayoutBoundsResult = null |
removeEventListener
(
type: String
,
listener: Function
): Void
Inherited from EventDispatcher
Removes an event listener from the object.
Parameters
type: String | |
listener: Function |
removeEventListeners
(
type: String
= null
): Void
Inherited from EventDispatcher
Removes all event listeners with a certain type, or all of them if type is null. Be careful when removing all event listeners: you never know who else was listening.
Parameters
type: String = null |