Skip to content
This repository was archived by the owner on Aug 9, 2019. It is now read-only.

PickerList range error #42

Open
bangersandflash opened this issue Nov 4, 2013 · 0 comments
Open

PickerList range error #42

bangersandflash opened this issue Nov 4, 2013 · 0 comments

Comments

@bangersandflash
Copy link

Setting the selectedIndexes of a NativeListDialog causes the following error:

Exception fault: RangeError: Error #1125: The index xx is out of range xx.

The index that the error occurs on is always the exact length of the dataprovider which would be one too many if we're using zero based arrays.

var list : NativeListDialog = new NativeListDialog(1);
list.buttons = Vector. (["Done"]);
list.dataProvider = Vector.([{label:One"}, {label:Two"}, {label:Three"}]);
list.labelField = "label";
list.displayMode = NativeListDialog.DISPLAY_MODE_MULTIPLE;
list.selectedIndexes = Vector.([1, 2, 3]);
list.show();

E.g the above code would throw the following error:
Exception fault: RangeError: Error #1125: The index 3 is out of range 3.

I think the bug is possibly around line 377 of NativeListDialog.as:
_selectedIndex = value[0];
for (var j:int = 0; j < len; j++)
{
_selectedValues[j] = false;
}
for each (var val:int in value)
{
if(!isNaN(val) && val>0 && val<len){
_selectedValues[j] = true;
}
}

Shouldn't the second for loop be nested in the first one so that the j index is in scope?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant