패키지 | spark.layouts |
클래스 | public class BasicLayout |
상속 | BasicLayout LayoutBase OnDemandEventDispatcher Object |
하위 클래스 | StackLayout |
언어 버전: | ActionScript 3.0 |
제품 버전: | Flex 4 |
런타임 버전: | Flash Player 10, AIR 1.5 |
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 theleft
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'spercentWidth
is not directly factored in the calculations, it will be respected during a call to theupdateDisplayList()
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 thebaseline
and minus the value of the element'sbaselinePosition
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 theverticalCenter
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
orpercentHeight
set, then its size is calculated as a percentage of the available size, where the available size is the container size minus anyleft
,right
,top
, orbottom
constraints. - If the element has both left and right constraints, it's width is
set to be the container's width minus the
left
andright
constraints. - If the element has both
top
andbottom
constraints, it's height is set to be the container's height minus thetop
andbottom
constraints. - The element is set to its preferred width and/or height.
The BasicLayout class calculates its minimum size as the maximum of the minimum child sizes:
- For each child in the container, determine the minimum size
to which the child could shrink:
- If the child is constrained to its parent's width or height, then the child could shrink to its minimum width or height. Use the minimum size of the child.
- If the child is not constrained to the parent, then it remains at its preferred size. Use the preferred size of the child.
- Find the maximum of the sizes from step 1.
Therefore, if a child is constrained to its parent, then the layout uses the child's minimum size. Otherwise, it uses its preferred size of the child to calculate the minimum size for the container.
The element's position is determined according to the rules in the following order of precedence:
- The
horizontalCenter
orverticalCenter
constraints specify the distance between the container's center and the element's center. Set thehorizontalCenter
orverticalCenter
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 withbaseline
constraint. - If element's
top
orleft
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
orright
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 구문MXML 구문 숨기기The <s:BasicLayout>
tag inherits all of the tag
attributes of its superclass and adds no additional tag attributes:
<s:BasicLayout/>
기타 예제
Setting the layout of a Spark container
Setting the padding and gap of a layout
Setting the alignment of a layout
Setting the row height or column width of a layout
메서드 | 정의 주체 | ||
---|---|---|---|
Constructor. | BasicLayout | ||
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Registers an event listener object with an EventDispatcher object so that the listener
receives notification of an event. | OnDemandEventDispatcher | ||
Calculates the drop location in the data provider of the drop target for
the specified dragEvent. | LayoutBase | ||
When useVirtualLayout is true,
this method can be used by the layout target
to clear cached layout information when the target changes. | LayoutBase | ||
Dispatches an event into the event flow. | OnDemandEventDispatcher | ||
Called by the target after a layout element
has been added and before the target's size and display list are
validated. | LayoutBase | ||
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 | ||
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 | ||
Returns the change to the horizontal scroll position to handle
different scrolling options. | LayoutBase | ||
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 | ||
Computes the verticalScrollPosition and
horizontalScrollPosition deltas needed to
scroll the element at the specified index into view. | LayoutBase | ||
Returns the change to the vertical scroll position to handle
different scrolling options. | LayoutBase | ||
Checks whether the EventDispatcher object has any listeners registered for a specific type
of event. | OnDemandEventDispatcher | ||
지정된 속성이 객체에 정의되어 있는지 여부를 나타냅니다. | Object | ||
Hides the previously shown drop indicator,
created by the showDropIndicator() method,
removes it from the display list and also stops the drag scrolling. | LayoutBase | ||
Object 클래스의 인스턴스가 매개 변수로 지정된 객체의 프로토타입 체인에 있는지 여부를 나타냅니다. | Object | ||
Measures the target's default size based on its content, and optionally
measures the target's default minimum size. | LayoutBase | ||
지정된 속성이 존재하고 열거 가능한지 여부를 나타냅니다. | Object | ||
Removes a listener from the EventDispatcher object. | OnDemandEventDispatcher | ||
루프 작업에서 동적 속성을 사용할 수 있는지 여부를 설정합니다. | Object | ||
Sizes, positions and parents the drop indicator based on the specified
drop location. | LayoutBase | ||
로캘별 규칙에 따라 서식이 지정된 이 객체의 문자열 표현을 반환합니다. | Object | ||
지정된 객체의 문자열 표현을 반환합니다. | Object | ||
Sizes and positions the target's elements. | LayoutBase | ||
Called by the target at the end of its updateDisplayList
to have the layout update its scrollRect. | LayoutBase | ||
지정된 객체의 프리미티브 값을 반환합니다. | Object | ||
Checks whether an event listener is registered with this EventDispatcher object or any of its ancestors for the specified event type. | OnDemandEventDispatcher |
BasicLayout | () | 생성자 |
public function BasicLayout()
언어 버전: | ActionScript 3.0 |
제품 버전: | Flex 4 |
런타임 버전: | Flash Player 10, AIR 1.5 |
Constructor.
Tue Jun 12 2018, 03:17 PM Z