2 Replies Latest reply on Jan 20, 2007 6:37 AM by Timdej

    Arraycollection help

    Timdej
      if i have a Arraycollection filled with data from a http request which returns XML.
      And i am showing 1 piece of data at a time from the arraycollection, and with a next button i want go the the next piec of dat a from the arraycollection, how do i go to the next item in the Arraycollection?
        • 1. Re: Arraycollection help
          michael_ramirez44 Level 1
          Keep track of the index and increment is as needed.

          public function moveNext():Object
          {

          index++;
          if( index < myArray.length )
          {
          return myArray[index];
          }

          }
          • 2. Arraycollection help
            Timdej Level 1
            Hmm I could give that a try.

            I've tried to do it with an IViewCursor..

            this is my code:

            public function resultHandler(event:ResultEvent):void{
            myData = event.result.photos.photo;
            myData.sort;
            test = myData.refresh();
            cursor = myData.createCursor();
            }

            public function dataTransfer(event:MouseEvent):void{
            cursor.findAny(myList.selectedItem);
            }

            myList is a Tile list
            test is used in a label to check if the view has been sorted.

            the problem is that i keep getting a cursor error which says that i must sort the view even though i did that in the resultHandler which is initialized by the http service which is in turn initialized by the application.