flex-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Harui <aha...@adobe.com>
Subject RE: AsyncListView & DataGrid - Exception in GridViewLayout.as
Date Wed, 09 Oct 2013 16:23:49 GMT
If the exception doesn't cause any residual harm, you can always try to catch it with an UncaughtError
handler.

-Alex
________________________________________
From: Ulrich Andreas [Andreas.Ulrich@formware.de]
Sent: Wednesday, October 09, 2013 8:48 AM
To: users@flex.apache.org
Subject: AsyncListView & DataGrid - Exception in GridViewLayout.as

Hello everyone,

I'm using James Wards implementation of a virtual paged grid (http://www.jamesward.com/2010/10/11/data-paging-in-flex-4/
 https://github.com/jamesward/DataPaging/blob/master/src/PagedList.as)

It mostly works fine but I get an Exception in GridViewLayout.as when pulling the vertical
scrollbar right to the end resulting in loading the last Datablock.

It crashes in here:

private function freeLinearElements (
        elements:Vector.<IVisualElement>,
        oldIndices:Vector.<int>,
        newIndices:Vector.<int>,
        lastIndex:int):void
    {
        // TODO(hmuller): rewrite this, should be one pass (no indexOf)
        for (var i:int = 0; i < elements.length; i++)
        {
                 const offset:int = newIndices.indexOf(oldIndices[i]);
                if ((oldIndices[i] == lastIndex) || (offset == -1))
                {
                    const elt:IVisualElement = elements[i];
                    if (elt)
                    {
                        freeGridElement(elt);
                        elements[i] = null;
                    }
                }
        }
    }

The elements Vector (and thus the int i variable) is larger than the length of the oldIndices
Vector therefore access to oldIndices[i] throws an exception at some point.

I don't know how to catch this Exception in my Application Code - if this would be possible
at all.
To fix this issue I surrounded the loop with a try catch block and built a new spark.swf -
absolutely not the way I want to handle this :(

Should this be filed as a bug or is there any suggestion where I could tweak my application
code to prevent this exception?


Regards
Andi


Mime
View raw message