This is already in my whiteboard put I want to push it to trunk.
In ArrayList's itemUpdatedHandler, it checks the event.target and attempts to
get the index. However, in many cases (such as when you call itemUpdated())
this target is not defined. getItemIndex() returns a -1 in that case, but here
it is assigned to a unsigned integer, meaning the property it dispatches is
even more non-sensical than normal. Simple change right now is to make this
signed so we at least get the -1. Any objections?
protected function itemUpdateHandler(event:PropertyChangeEvent):void
{
internalDispatchEvent(CollectionEventKind.UPDATE, event);
// need to dispatch object event now
if (_dispatchEvents == 0 &&
hasEventListener(PropertyChangeEvent.PROPERTY_CHANGE))
{
var objEvent:PropertyChangeEvent =
PropertyChangeEvent(event.clone());
var index:uint = getItemIndex(event.target);
objEvent.property = index.toString() + "." + event.property;
dispatchEvent(objEvent);
}
}
Proposed:
protected function itemUpdateHandler(event:PropertyChangeEvent):void
{
internalDispatchEvent(CollectionEventKind.UPDATE, event);
// need to dispatch object event now
if (_dispatchEvents == 0 &&
hasEventListener(PropertyChangeEvent.PROPERTY_CHANGE))
{
var objEvent:PropertyChangeEvent =
PropertyChangeEvent(event.clone());
//When itemUpdated is called, there is no event target. This
means getItemIndex returns a -1
//Since this was originally cast as a uint, this caused many
strange results. Changing it to
//an int to be consistent throughout other uses of this event
var index:int = getItemIndex(event.target);
objEvent.property = index.toString() + "." + event.property;
dispatchEvent(objEvent);
}
}
digital primates (r)
Michael Labriola
[email protected]<mailto:[email protected]>
tel: +1.773.693.7800 x206
fax: +1.773.409.9251