Create cursor from ArrayCollection and Move cursor : ArrayCollection Cursor « Data Model « Flex






Create cursor from ArrayCollection and Move cursor

Create cursor from ArrayCollection and Move cursor
          

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical">

    <mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" width="400" height="300" creationComplete="init()">
    <mx:Script>
        
            import mx.collections.SortField;
            import mx.collections.Sort;
            import mx.collections.IViewCursor;
            import mx.collections.CursorBookmark;
            import mx.collections.ArrayCollection;

            [Bindable]
            private var coll:ArrayCollection;

            [Bindable]
            private var cursor:IViewCursor;

            private function init():void {
                coll = new ArrayCollection([{city:"A", state:"C", region:"E"},  
                                            {city:"B", state:"D", region:"F"}]);
                cursor = coll.createCursor();
            }
    
      
    </mx:Script>
    <mx:Label text="{cursor.current.city}"/>
    <mx:Button click="cursor.moveNext()" label="Next"/>
    <mx:Button click="cursor.movePrevious()" label="Previous"/>
</mx:VBox>
</mx:Application>  

   
    
    
    
    
    
    
    
    
    
  








Related examples in the same category

1.Get cursor position after removing an item from cursorGet cursor position after removing an item from cursor
2.Create IViewCursor from ArrayCollectionCreate IViewCursor from ArrayCollection
3.Move cursor to nextMove cursor to next
4.Seek last cursor positionSeek last cursor position
5.Find first item through a cursorFind first item through a cursor
6.Find item through cursorFind item through cursor
7.Seek the last cursor positionSeek the last cursor position
8.Get bookmark from CursorGet bookmark from Cursor
9.Get current cursor valueGet current cursor value