• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

New Here ,
Jun 23, 2012 Jun 23, 2012

Copy link to clipboard

Copied

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

TOPICS
ActionScript

Views

626

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 23, 2012 Jun 23, 2012

Copy link to clipboard

Copied

LATEST

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");

          }

}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines