Open esidegallery opened 2 years ago
@joshtynjala I have the same issue + two more. All issues are related to drag and drop.
First, with useVirtualLayout = true
and hasVariableItemDimensions = true
I got this:
In VirtualLayout.as in function positionDropIndicator()
lines 1550-1551 items[indexMinusOffset]
results null.
Since the items are virtual, not all of them are constructed and somehow this gives an error. This prompted me to stop using a virtual layout.
Second, with useVirtualLayout = false
I got this:
In VirtualLayout.as in function getDropIndex()
lines 1636 positionY = item.y; item is null and get Err:1009
This I managed to debug a bit:
var itemCount:int = items.length;
var totalItemCount:int = itemCount;
if(this._useVirtualLayout && !this._hasVariableItemDimensions)
{
totalItemCount += this._beforeVirtualizedItemCount + this._afterVirtualizedItemCount;
indexOffset = this._beforeVirtualizedItemCount;
}
var secondToLastIndex:int = totalItemCount - 2;
for(var i:int = 0; i <= totalItemCount; i++)
{
var item:DisplayObject = null;
var indexMinusOffset:int = i - indexOffset;
if(indexMinusOffset >= 0 && indexMinusOffset < itemCount)
{
item = items[indexMinusOffset];
}
In the for, i <= totalItemCount
and totalItemCount = items.length
and it's running out of bounds. Apparently by fixing the sign the problem goes away.
Third, while testing on the List in the component explorer, the item being dragged, changed text. I think data is still being referenced from the initial object and that changes with the virtual layout.
This is a fix for the first and second problem.
When dragging an item to the end of a list with a non-virtual vertical layout, the following error is thrown:
In VirticalLayout.as,
item.y
is accessed without testing for the existence ofitem
.Below is an example to recrate the issue: