Hi, I face a historical problem with virtual lists: When we navigate through 
the items of a virtual list, usually with the mouse wheel, arbitrarily an error 
occurs in UIBase when retrieving the child on which the mouse is located 
"because the requested child has not yet been created" (asynchronous). I can't 
solve it, among other reasons, because when debugging "it doesn't give error".
After many tests, with this small modification that I am going to propose you, 
we could avoid the error:

would this modification be correct in UIBase?

        public function getElementAt(index:int):IChild
        {
            COMPILE::SWF
            {
                return $sprite_getChildAt(index) as IChild;
            }
            COMPILE::JS
            {
                var children:Array = internalChildren();
                if (children.length == 0) //<---------------------- [1]
                {
                    return null;
                }
                return children[index].royale_wrapper;
            }
        }

[1] Now it only checks if there are elements but does not check if the index 
being requested exists. Could we add.... (children == 0 || index >= 
children.length)?
                if (children == 0 || index >= children.length)
                {
                    return null;
                }

The problem can be reproduced with the TDJ 
https://royale.apache.org/tourdejewel/#!virtual_lists_panel
It is not a significant change, I have implemented the change in the SDK, 
compiled (js && js-swf) and tested 4 different projects without any issues.

Hiedra

Reply via email to