Skip to main content
Participant
Aug 2, 2010 9:16 AM UTC
Question

How to iterate through arraycollection in flex

How to iterate through arraycollection in flex

    This topic is closed to new replies. Start a new post to keep the conversation going.

    4 replies

    Aug 2, 2010 11:15 AM UTC

    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

    Translate
    Aug 2, 2010 11:22 AM UTC

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

    just research into loops

    Translate
    Participating Frequently
    Aug 2, 2010 11:33 AM UTC

    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.

    Translate
    Participating Frequently
    Aug 2, 2010 10:59 AM UTC
    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.

    Translate