Hello,
I have a class which constructs multiple instances of another class and adds multiple eventListeners to each instance:
Code:
for(var i:Number = 0; i < length; i++){
var myItem:Item = new Item();
var load_lst:Object = Delegate.create(this, onOpen);
myItem.addEventListener("onOpen", load_lst);
var load_lst:Object = Delegate.create(this, onSelected);
myItem.addEventListener("onSelected", load_lst);
var load_lst:Object = Delegate.create(this, onClose);
myItem.addEventListener("onClose", load_lst);
item_ar.push(myItem);
}
When an onClose event is recieved I need to remove all these listeners from the item before destroying it, but how can I retrieve a reference to them?
At the moment I am using a separate Array which stores them, but is there a better way?
Thanks