| 包 | mx.effects |
| 类 | public class RemoveItemAction |
| 继承 | RemoveItemAction Effect EventDispatcher Object |
隐藏 MXML 语法The <mx:RemoveItemAction> tag
inherits all of the tag attributes of its superclass,
and adds no new tag attributes:
<mx:RemoveItemAction />
另请参见
| 方法 | 定义方 | ||
|---|---|---|---|
RemoveItemAction(target:Object = null) 构造函数。 | RemoveItemAction | ||
![]() | addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void 使用 EventDispatcher 对象注册事件侦听器对象,以使侦听器能够接收事件通知。 | EventDispatcher | |
![]() | 捕获效果目标上相关属性的当前值,并将这些值另存为结束值。 | Effect | |
![]() | 捕获另一组目标相关属性的当前值。在运行数据更改效果时,此函数由 Flex 使用。 | Effect | |
![]() | 捕获效果目标上相关属性的当前值。 | Effect | |
![]() | 创建一个效果实例并对其进行初始化。 | Effect | |
![]() | 获取一个目标对象 Array,并对每个目标调用 createInstance() 方法。 | Effect | |
![]() | 删除实例中的事件侦听器,然后从实例列表中删除该实例。 | Effect | |
![]() | 将事件调度到事件流中。 | EventDispatcher | |
![]() | 中断当前正在播放的效果,立即跳转到该效果的末尾。 | Effect | |
![]() | 返回一个字符串 Array,其中每个 String 都是被此效果更改的属性名称。 | Effect | |
![]() | 检查 EventDispatcher 对象是否为特定事件类型注册了任何侦听器。 | EventDispatcher | |
![]() |
指示对象是否已经定义了指定的属性。 | Object | |
![]() |
指示 Object 类的实例是否在指定为参数的对象的原型链中。 | Object | |
![]() | 暂停效果,直到调用 resume() 方法。 | Effect | |
![]() | 开始播放效果。 | Effect | |
![]() |
指示指定的属性是否存在、是否可枚举。 | Object | |
![]() | 从 EventDispatcher 对象中删除侦听器。 | EventDispatcher | |
![]() | 在效果由 pause() 方法暂停后继续播放效果。 | Effect | |
![]() | 逆序播放效果;如果当前正在播放效果,则从该效果的当前位置开始逆序播放。 | Effect | |
![]() |
设置循环操作动态属性的可用性。 | Object | |
![]() | 停止播放效果,使效果目标保持当前状态。 | Effect | |
![]() |
返回指定对象的字符串表示形式。 | Object | |
![]() |
返回指定对象的原始值。 | Object | |
![]() | 检查是否用此 EventDispatcher 对象或其任何始祖为指定事件类型注册了事件侦听器。 | EventDispatcher | |
| RemoveItemAction | () | 构造函数 |
public function RemoveItemAction(target:Object = null)构造函数。
参数target:Object (default = null) — 要使用此效果为其设置动画的 Object。 |
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
import mx.effects.easing.Elastic;
import mx.collections.ArrayCollection;
[Bindable]
private var myDP:ArrayCollection = new ArrayCollection(
['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P']);
private function deleteItem():void {
// As each item is removed, the index of the other items changes.
// So first get the items to delete, then determine their indices
// as you remove them.
var toRemove:Array = [];
for (var i:int = 0; i < tlist0.selectedItems.length; i++)
toRemove.push(tlist0.selectedItems[i]);
for (i = 0; i < toRemove.length; i++)
myDP.removeItemAt(myDP.getItemIndex(toRemove[i]));
}
private var zcount:int = 0;
private function addItem():void {
// Always add the new item after the third item,
// or after the last item if the length is less than 3.
myDP.addItemAt("Z"+zcount++,Math.min(3,myDP.length));
}
]]>
</mx:Script>
<!-- Define a custom data effect as a Sequence effect. -->
<mx:Sequence id="itemsChangeEffect1">
<mx:Blur
blurYTo="12" blurXTo="12"
duration="300"
perElementOffset="150"
filter="removeItem"/>
<mx:Parallel>
<mx:Move
duration="750"
easingFunction="{Elastic.easeOut}"
perElementOffset="20"/>
<mx:RemoveItemAction
startDelay="400"
filter="removeItem"/>
<mx:AddItemAction
startDelay="400"
filter="addItem"/>
<mx:Blur
startDelay="410"
blurXFrom="18" blurYFrom="18" blurXTo="0" blurYTo="0"
duration="300"
filter="addItem"/>
</mx:Parallel>
</mx:Sequence>
<mx:Panel title="AddItemEffect/RemoveItemEffect Example" width="75%" height="75%"
paddingTop="10" paddingLeft="10" paddingRight="10" paddingBottom="10">
<!-- This TileList uses a custom data change effect -->
<mx:TileList id="tlist0"
height="100%" width="100%"
fontSize="18" fontStyle="bold"
columnCount="4" rowCount="4"
direction="horizontal"
dataProvider="{myDP}"
allowMultipleSelection="true"
offscreenExtraRowsOrColumns="4"
itemsChangeEffect="{itemsChangeEffect1}"/>
<mx:Button
label="Delete selected item(s)"
click="deleteItem();"/>
<mx:Button
label="Add item"
click="addItem();"/>
</mx:Panel>
</mx:Application>