📄 storeitemcollection.as
字号:
package mx.item.collection
{
import flash.events.Event;
import flash.events.EventDispatcher;
import mx.item.data.StoreItem;
public class StoreItemCollection extends EventDispatcher
{
private var _collection:Array;
public function get count():uint {
return _collection.length;
}
public function StoreItemCollection()
{
_collection = new Array();
}
public function addItem(item:StoreItem):void {
_collection.push(item);
item.collection = this;
dispatchEvent(new Event(Event.CHANGE));
}
public function removeItem(item:StoreItem):void {
var i:uint;
for(i = 0; i <_collection.length; i++) {
if(_collection[i] == item) {
_collection.splice(i,1);
break; // Break For Dongusunu Termınate Edıcektır
}
}
dispatchEvent(new Event(Event.CHANGE));
}
public function getItem(index:uint):StoreItem {
return StoreItem(_collection[index]);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -