Adobe® Flex® 4 Language Reference
Hide Packages and Classes List |  Packages  |  Classes  |  Index  |  Appendixes
spark.layouts 
BasicLayout 
Packagespark.layouts
Classpublic class BasicLayout
InheritanceBasicLayout Inheritance LayoutBase Inheritance OnDemandEventDispatcher Inheritance Object

Language Version: ActionScript 3.0
Product Version: Flex 4
Runtime Versions: Flash Player 10, AIR 1.5

The BasicLayout class arranges the layout elements according to their individual settings, independent of each-other. BasicLayout, also called absolute layout, requires that you explicitly position each container child. You can use the x and y properties of the child, or constraints to position each child.

Note: The Spark list-based controls (the Spark List control and its subclasses such as ButtonBar, ComboBox, DropDownList, and TabBar) do not support the BasicLayout class. Do not use BasicLayout with the Spark list-based controls.

Per-element supported constraints are left, right, top, bottom, horizontalCenter, verticalCenter, baseline, percentWidth, and percentHeight. Element's minimum and maximum sizes will always be respected.

The measured size of the container is calculated from the elements, their constraints and their preferred sizes. The measured size of the container is big enough to fit in all of the elements at their preferred sizes with their constraints satisfied.

Here are some examples of how measured size is calculated:

  • If the container has a single element with left constraint specified, then the container's measured width will be equal to the element's preferred width plus the value of the left constraint.
  • If the container has a single element with percentWidth specified, then the container's measured width will be equal to the element's preferred width. Even though the element's percentWidth is not directly factored in the calculations, it will be respected during a call to the updateDisplayList() method.
  • If the container has a single element with baseline constraint specified, then the container's measured height will be equal to the element's preferred height plus the baseline and minus the value of the element's baselinePosition property.
  • If the container has a single element with verticalCenter constraint specified, then the container's measured height will be equal to the element's preferred height plus double the value of the verticalCenter constraint.

During a call to the updateDisplayList() method, the element's size is determined according to the rules in the following order of precedence (the element's minimum and maximum sizes are always respected):

  • If the element has percentWidth or percentHeight set, then its size is calculated as a percentage of the available size, where the available size is the container size minus any left, right, top, or bottom constraints.
  • If the element has both left and right constraints, it's width is set to be the container's width minus the left and right constraints.
  • If the element has both top and bottom constraints, it's height is set to be the container's height minus the top and bottom constraints.
  • The element is set to its preferred width and/or height.

The element's position is determined according to the rules in the following order of precedence:

  • The horizontalCenter or verticalCenter constraints specify the distance between the container's center and the element's center. Set the horizontalCenter or verticalCenter constraints to zero to center the element within the container in the horizontal or vertical direction.
  • If element's baseline is specified, then the element is positioned in the vertical direction such that its baselinePosition (usually the base line of its first line of text) is aligned with baseline constraint.
  • If element's top or left constraints are specified, then the element is positioned such that the top-left corner of the element's layout bounds is offset from the top-left corner of the container by the specified values.
  • If element's bottom or right constraints are specified, then the element is positioned such that the bottom-right corner of the element's layout bounds is offset from the bottom-right corner of the container by the specified values.
  • When no constraints determine the position in the horizontal or vertical direction, the element is positioned according to its x and y coordinates.

The content size of the container is calculated as the maximum of the coordinates of the bottom-right corner of all the layout elements.

MXML SyntaxexpandedHide MXML Syntax

The <s:BasicLayout> tag inherits all of the tag attributes of its superclass and adds no additional tag attributes:

  <s:BasicLayout/>
  

See also



Public Properties
 PropertyDefined By
 InheritedclipAndEnableScrolling : Boolean
If true, specifies to clip the children to the boundaries of the viewport.
LayoutBase
 Inheritedconstructor : Object
A reference to the class object or constructor function for a given object instance.
Object
 InheriteddropIndicator : DisplayObject
The DisplayObject that this layout uses for the drop indicator during a drag-and-drop operation.
LayoutBase
 InheritedhorizontalScrollPosition : Number
The x coordinate of the origin of the viewport in the component's coordinate system, where the default value is (0,0) corresponding to the upper-left corner of the component.
LayoutBase
 Inheritedprototype : Object
[static] A reference to the prototype object of a class or function object.
Object
 Inheritedtarget : GroupBase
The GroupBase container whose elements are measured, sized and positioned by this layout.
LayoutBase
 InheritedtypicalLayoutElement : ILayoutElement
Used by layouts when fixed row/column sizes are requested but a specific size isn't specified.
LayoutBase
 InheriteduseVirtualLayout : Boolean
A container can hold any number of children.
LayoutBase
 InheritedverticalScrollPosition : Number
The y coordinate of the origin of the viewport in the component's coordinate system, where the default value is (0,0) corresponding to the upper-left corner of the component.
LayoutBase
Public Methods
 MethodDefined By
  
Constructor.
BasicLayout
 Inherited
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
OnDemandEventDispatcher
 Inherited
Calculates the drop location in the data provider of the drop target for the specified dragEvent.
LayoutBase
 Inherited
When useVirtualLayout is true, this method can be used by the layout target to clear cached layout information when the target changes.
LayoutBase
 Inherited
OnDemandEventDispatcher
 Inherited
Called by the target after a layout element has been added and before the target's size and display list are validated.
LayoutBase
 Inherited
This method must is called by the target after a layout element has been removed and before the target's size and display list are validated.
LayoutBase
 Inherited
Returns the specified element's layout bounds as a Rectangle or null if the index is invalid, the corresponding element is null, includeInLayout=false, or if this layout's target property is null.
LayoutBase
 Inherited
Returns the change to the horizontal scroll position to handle different scrolling options.
LayoutBase
 Inherited
getNavigationDestinationIndex(currentIndex:int, navigationUnit:uint, arrowKeysWrapFocus:Boolean):int
Delegation method that determines which item to navigate to based on the current item in focus and user input in terms of NavigationUnit.
LayoutBase
 Inherited
Computes the verticalScrollPosition and horizontalScrollPosition deltas needed to scroll the element at the specified index into view.
LayoutBase
 Inherited
Returns the change to the horizontal scroll position to handle different scrolling options.
LayoutBase
 Inherited
OnDemandEventDispatcher
 Inherited
Indicates whether an object has a specified property defined.
Object
 Inherited
Hides the previously shown drop indicator, created by the showDropIndicator() method, removes it from the display list and also stops the drag scrolling.
LayoutBase
 Inherited
Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter.
Object
 Inherited
Measures the target's default size based on its content, and optionally measures the target's default minimum size.
LayoutBase
 Inherited
Indicates whether the specified property exists and is enumerable.
Object
 Inherited
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
OnDemandEventDispatcher
 Inherited
Sets the availability of a dynamic property for loop operations.
Object
 Inherited
Sizes, positions and parents the drop indicator based on the specified drop location.
LayoutBase
 Inherited
Returns the string representation of this object, formatted according to locale-specific conventions.
Object
 Inherited
Returns the string representation of the specified object.
Object
 Inherited
Sizes and positions the target's elements.
LayoutBase
 Inherited
Called by the target at the end of its updateDisplayList to have the layout update its scrollRect.
LayoutBase
 Inherited
Returns the primitive value of the specified object.
Object
 Inherited
OnDemandEventDispatcher
Protected Methods
 MethodDefined By
 Inherited
Calculates how much to scroll for the specified dropLocation during a drag and drop gesture.
LayoutBase
 Inherited
Returns the index where a new item should be inserted if the user releases the mouse at the specified coordinates while completing a drag and drop gesture.
LayoutBase
 Inherited
Calculates the bounds for the drop indicator that provides visual feedback to the user of where the items will be inserted at the end of a drag and drop gesture.
LayoutBase
 Inherited
Returns the bounds of the first layout element that either spans or is above the scrollRect's top edge.
LayoutBase
 Inherited
Returns the bounds of the first layout element that either spans or is below the scrollRect's bottom edge.
LayoutBase
 Inherited
Returns the bounds of the first layout element that either spans or is to the left of the scrollRect's left edge.
LayoutBase
 Inherited
Returns the bounds of the first layout element that either spans or is to the right of the scrollRect's right edge.
LayoutBase
 Inherited
Returns the bounds of the target's scroll rectangle in layout coordinates.
LayoutBase
 Inherited
Called when the verticalScrollPosition or horizontalScrollPosition properties change.
LayoutBase
Constructor Detail

BasicLayout

()Constructor
public function BasicLayout()

Language Version: ActionScript 3.0
Product Version: Flex 4
Runtime Versions: Flash Player 10, AIR 1.5

Constructor.