套件 | mx.core |
介面 | public interface IVisualElementContainer |
實作者 | Container, ContainerMovieClip, Group, Scroller, SkinnableContainer |
語言版本: | ActionScript 3.0 |
產品版本: | Flex 4 |
執行階段版本: | Flash Player 10, AIR 1.5 |
Note that the Spark SkinnableDataContainer and DataGroup containers
do not implement this interface.
Those containers manage their
children through the dataProvider
property.
相關 API 元素
屬性 | 定義自 | ||
---|---|---|---|
numElements : int [唯讀]
The number of visual elements in this container. | IVisualElementContainer |
方法 | 定義自 | ||
---|---|---|---|
Adds a visual element to this container. | IVisualElementContainer | ||
Adds a visual element to this container. | IVisualElementContainer | ||
Returns the visual element at the specified index. | IVisualElementContainer | ||
Returns the index position of a visual element. | IVisualElementContainer | ||
Removes all visual elements from the container. | IVisualElementContainer | ||
Removes the specified visual element from the child list of
this container. | IVisualElementContainer | ||
Removes a visual element from the specified index position
in the container. | IVisualElementContainer | ||
Changes the position of an existing visual element in the visual container. | IVisualElementContainer | ||
Swaps the index of the two specified visual elements. | IVisualElementContainer | ||
Swaps the visual elements at the two specified index
positions in the container. | IVisualElementContainer |
numElements | 屬性 |
numElements:int
[唯讀] 語言版本: | ActionScript 3.0 |
產品版本: | Flex 4 |
執行階段版本: | Flash Player 10, AIR 1.5 |
The number of visual elements in this container. Visual elements include classes that implement the IVisualElement interface, such as subclasses of UIComponent and GraphicElement.
實作
public function get numElements():int
addElement | () | 方法 |
public function addElement(element:IVisualElement):IVisualElement
語言版本: | ActionScript 3.0 |
產品版本: | Flex 4 |
執行階段版本: | Flash Player 10, AIR 1.5 |
Adds a visual element to this container.
The element is added after all other elements
and appears top of all other elements.
To add a visual element to a specific index position, use
the addElementAt()
method.
If you add a visual element that already has a different container as a parent, the element is removed from the other container.
參數
element:IVisualElement — The visual element to add as a child of this container.
|
IVisualElement — The element that was added.
|
事件
elementAdd: — Dispatched when
the element is added to the child list.
|
擲回值
ArgumentError — If the element is the same as the visual container.
|
addElementAt | () | 方法 |
public function addElementAt(element:IVisualElement, index:int):IVisualElement
語言版本: | ActionScript 3.0 |
產品版本: | Flex 4 |
執行階段版本: | Flash Player 10, AIR 1.5 |
Adds a visual element to this container. The element is added at the index position specified. An index of 0 represents the first element in the display list.
If you add a visual element that already has a different container as a parent, the element is removed from the other container.
參數
element:IVisualElement — The element to add as a child of this visual container.
| |
index:int — The index position to which the element is added. If
you specify a currently occupied index position, the child
that exists at that position and all higher positions are moved
up one position in the child list.
|
IVisualElement — The element that was added.
|
事件
elementAdd: — Dispatched when
the element is added to the child list.
|
擲回值
ArgumentError — If the element is the same as the container.
| |
RangeError — If the index position does not exist in the child list.
|
getElementAt | () | 方法 |
public function getElementAt(index:int):IVisualElement
語言版本: | ActionScript 3.0 |
產品版本: | Flex 4 |
執行階段版本: | Flash Player 10, AIR 1.5 |
Returns the visual element at the specified index.
參數
index:int — The index of the element to retrieve.
|
IVisualElement — The element at the specified index.
|
擲回值
RangeError — If the index position does not exist in the child list.
|
getElementIndex | () | 方法 |
public function getElementIndex(element:IVisualElement):int
語言版本: | ActionScript 3.0 |
產品版本: | Flex 4 |
執行階段版本: | Flash Player 10, AIR 1.5 |
Returns the index position of a visual element.
參數
element:IVisualElement — The visual element.
|
int — The index position of the element in the container.
|
擲回值
ArgumentError — If the element is not a child of this visual container.
|
removeAllElements | () | 方法 |
public function removeAllElements():void
語言版本: | ActionScript 3.0 |
產品版本: | Flex 4 |
執行階段版本: | Flash Player 10, AIR 1.5 |
Removes all visual elements from the container.
removeElement | () | 方法 |
public function removeElement(element:IVisualElement):IVisualElement
語言版本: | ActionScript 3.0 |
產品版本: | Flex 4 |
執行階段版本: | Flash Player 10, AIR 1.5 |
Removes the specified visual element from the child list of this container. The index positions of any elements above the element in this visual container are decreased by 1.
參數
element:IVisualElement — The element to be removed from the container.
|
IVisualElement — The element removed.
|
擲回值
ArgumentError — If the element parameter is not a child of
this visual container.
|
removeElementAt | () | 方法 |
public function removeElementAt(index:int):IVisualElement
語言版本: | ActionScript 3.0 |
產品版本: | Flex 4 |
執行階段版本: | Flash Player 10, AIR 1.5 |
Removes a visual element from the specified index position in the container. The index positions of any elements above the element in this visual container are decreased by 1.
參數
index:int — The index of the element to remove.
|
IVisualElement — The element removed.
|
擲回值
RangeError — If the index does not exist in the child list.
|
setElementIndex | () | 方法 |
public function setElementIndex(element:IVisualElement, index:int):void
語言版本: | ActionScript 3.0 |
產品版本: | Flex 4 |
執行階段版本: | Flash Player 10, AIR 1.5 |
Changes the position of an existing visual element in the visual container.
When you call the setElementIndex()
method and specify an
index position that is already occupied, the only positions
that change are those in between the elements's former and new position.
All others stay the same.
If a visual element is moved to an index lower than its current index, the index of all elements in between increases by 1. If an element is moved to an index higher than its current index, the index of all elements in between decreases by 1.
參數
element:IVisualElement — The element for which you want to change the index number.
| |
index:int — The resulting index number for the element.
|
擲回值
RangeError — If the index does not exist in the child list.
| |
ArgumentError — If the element parameter is not a child
of this visual container.
|
swapElements | () | 方法 |
public function swapElements(element1:IVisualElement, element2:IVisualElement):void
語言版本: | ActionScript 3.0 |
產品版本: | Flex 4 |
執行階段版本: | Flash Player 10, AIR 1.5 |
Swaps the index of the two specified visual elements. All other elements remain in the same index position.
參數
element1:IVisualElement — The first visual element.
| |
element2:IVisualElement — The second visual element.
|
swapElementsAt | () | 方法 |
public function swapElementsAt(index1:int, index2:int):void
語言版本: | ActionScript 3.0 |
產品版本: | Flex 4 |
執行階段版本: | Flash Player 10, AIR 1.5 |
Swaps the visual elements at the two specified index positions in the container. All other visual elements remain in the same index position.
參數
index1:int — The index of the first element.
| |
index2:int — The index of the second element.
|
擲回值
RangeError — If either index does not exist in
the visual container.
|
Tue Jun 12 2018, 03:47 PM Z