Skip to main content
New Participant
August 2, 2010
Question

How to iterate through arraycollection in flex

  • August 2, 2010
  • 2 replies
  • 20798 views

How to iterate through arraycollection in flex

    This topic has been closed for replies.

    2 replies

    August 2, 2010

    Hi ,

    Infact it is..

    for ( var x:int = 0; x < ac.length; ++x )
    {
         trace(ac.getItemAt(x).property);
    }

    OR

    for ( var o:Object in ac )
    {
         trace(o.property);
    }

    Thanks,

    Chari

    August 2, 2010

    or a foreach loop, or a while loop, or a dowhile loop.

    just research into loops

    Participating Frequently
    August 2, 2010

    Yep. It's early and I screwed up! The thing to remember with the ArrayCollection is that it is simply a wrapper around an underlying Array that carries an object-oriented design along with some additional functionality such as enhanced sorting.

    A quick web search may yield many examples of this faster than the forum.

    Participating Frequently
    August 2, 2010
    for ( var x:int = 0; x < ac.length; ++x )
    {
         trace(ac.getItemAt(x).property);
    }

    OR

    for ( var o:Object in ac )
    {
         trace(o.property);
    }

    Fixed the item access in the first example.