Skip navigation
logonsuresh
Currently Being Moderated

list.getItemAt issue - not working out of height or row count range

Jun 23, 2012 2:56 AM

List.getItem is working based upon the list height or rowCount. Out of range is not working.

Any body have any idea to clear this?

 

Thanks

Sureshkumar G

 
Replies
  • Currently Being Moderated
    Jun 23, 2012 6:21 AM   in reply to logonsuresh

    Can you elaborate more? Out of range is working perfectly fine for me. Full example:

     

    import fl.controls.List;

    import fl.data.DataProvider;

    import flash.events.Event;

     

    // make a quick dataprovider with 50 items

    var dp:DataProvider = new DataProvider();

    for (var i:int = 0; i < 50; i++)

    {

              dp.addItem({label:"item "+i,value:i});

    }

     

    // make list control

    var myList:List = new List();

    addChild(myList);

    myList.setSize(100,300);

    myList.dataProvider = dp;

     

    // wait for frame to be drawn before accessing

    addEventListener(Event.ENTER_FRAME, handleAddedToStage);

     

    function handleAddedToStage(e:Event):void

    {

              removeEventListener(Event.ENTER_FRAME, handleAddedToStage);

     

              // traces item 5

              trace("Item: " + myList.getItemAt(5).label);

     

              // traces item 35, despite out of view

              trace("Item: " + myList.getItemAt(35).label);

     

              try

              {

                        trace("Item: " + myList.getItemAt(95).label);

              }

              catch (e:RangeError)

              {

                        // traces out, value out of range

                        trace("Out of range");

              }

    }

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points