This is not so much a solution, but a workaround. I can't seem to find a way of 'unlocking' the ArrayCollection once a sort has been set on it, at which point any manual sorting using drag and drop fails to work.
So instead i call sort, refresh, set sort to null and then set the source of the ArrayCollection as it's own List as an Array, by calling ArrayCollection.toArray().
ActionScript Code:
public function set mode( md:String ):void
{
if( _mode != md )
{
_mode = md;
var srt : Sort = new Sort();
srt.fields = [ new SortField( _mode, false, false, true ) ];
_images.sort = srt;
_images.refresh();
_images.sort = null;
_images.source = _images.toArray();
}
}
if you just call
then try and drag and drop, the Error is thrown. But if you don't call it before setting the source of the Array as it's own list as Array, the source and the ArrayCollection match each other, but the ArrayCollection is still locked? So i have to do this,
ActionScript Code:
_images.sort = null;
_images.source = _images.toArray();
There must be a way to unlock the ArrayCollection once sort has been set, but i don't seem to be able to work out what it is? At least this workaround will stop my head from exlpoding.