Did you try the modifications I outline on James blog ?

Tom

On 09/10/2013 16:48, Ulrich Andreas wrote:
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

______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________



Reply via email to