Get cursor position after removing an item from cursor : ArrayCollection Cursor « Data Model « Flex






Get cursor position after removing an item from cursor

Get cursor position after removing an item from cursor
          

<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
    initialize="initData();">
    <mx:Script>
        
        import mx.collections.*;
        public var myArray:Array = [{label:"A", data:"1"},
                                    {label:"B", data:"2"}, 
                                    {label:"C", data:"3"}];
        [Bindable]
        public var myAC:ArrayCollection;
        public var myCursor:IViewCursor;
        
        public function initData():void {
            myAC = new ArrayCollection(myArray);
        }
        public function testCollection():void {
            data.myCursor=myAC.createCursor();
            ta1.text="cursor is at: " + myCursor.current.label;
            var removedItem:String=String(myCursor.remove());
            ta1.text+="cursor is at: " + myCursor.current.label;
        }
      
    </mx:Script>
    <mx:ComboBox id="myCB" rowCount="7" dataProvider="{myAC}" />
    <mx:TextArea id="ta1" height="75" width="350" />
    <mx:Button label="run test" click="testCollection();" />
</mx:Application>

   
    
    
    
    
    
    
    
    
    
  








Related examples in the same category

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