 import mx.core.IVisualElement;
 import mx.core.mx_internal;
 
+import spark.components.DataGroup;
 import spark.components.SpinnerList;
 import spark.components.supportClasses.GroupBase;
 import spark.core.NavigationUnit;

        // casting as an object
        try
        {
            if (!element || element["enabled"] == undefined || element["enabled"] == true)
                return true;
        }
        catch (e:Error)

	{
		var index:int = Math.floor(position.y / rowHeight); // may be larger than numElements to indicate wrapping
		
        var item:Object;
		var startIndex:int = index % target.numElements;
        var distance:int = 0;
        var direction:int = autoScrollAscending ? 1 : -1;
        var dataGroup:DataGroup = target as DataGroup;
        
		if (startIndex < 0)
            startIndex += target.numElements;
		
		// If the element at index % numElements) is not selectable, find the nearest one that is              
        var iter:LayoutIterator = new LayoutIterator(target, startIndex);
        
        if (dataGroup)
        {
            while (Math.abs(distance) <= (target.numElements / 2) + 1)
            {
                // Try searching in one direction
                iter.currentIndex = startIndex + distance * direction;

                item = dataGroup.dataProvider.getItemAt(normalizeItemIndex(iter.currentIndex));
                
                if (isElementEnabled(item))
                    break;
                
                if (distance != 0)
                {
                    // Flip the direction
                    direction *= -1;
                    
                    // Try searching in the other direction
                    iter.currentIndex = startIndex + distance * direction;
                    item = dataGroup.dataProvider.getItemAt(normalizeItemIndex(iter.currentIndex));   
                    
                    if (isElementEnabled(item))
                        break;
                    
                    // Flip the direction back
                    direction *= -1;
                }
                
                distance++;
            }
        }
        
		// If we don't allow wrapping, then cap the max index
		if(!wrapElements)
			index = Math.max(0, Math.min(index, target.numElements - 1));
