Hi All, I am having a problem with IViewCursors.
I am trying to detect if there is another element or not, so I can activate a next and previous button. In short I can't watch or listen to events when the cursor changes in my view, as when I do, the current and the bookmark (which should be the current) are out of sync. The bookmark seems to be one behind. This code should show you the problem. Thanks Rob <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" backgroundColor="#333333" creationComplete="onCreationComplete()" width="100%" height="100%" viewSourceURL="srcview/index.html"> <mx:Script> <![CDATA[ import mx.events.FlexEvent; import mx.collections.ArrayCollection; import mx.collections.IViewCursor; import mx.collections.ICollectionView; import mx.binding.utils.ChangeWatcher; import mx.controls.Alert; public var myArrayCollection:ICollectionView = new ArrayCollection([ "Bobby", "Mark", "Trevor", "Jacey", "Tyler" ]); public var cursor:IViewCursor = myArrayCollection.createCursor(); public function onCreationComplete():void { ChangeWatcher.watch( cursor , ['current'] , test ); ChangeWatcher.watch( cursor , ['bookmark'] , test2 ); cursor.addEventListener( FlexEvent.CURSOR_UPDATE, test3); } public function test( e:Event ):void { // Triggered when the current property of the cursor changes trace('currentE, current='+cursor.current); trace('currentE, bookmark='+cursor.bookmark.value); trace('currentE, index='+cursor.bookmark.getViewIndex()); } public function test2( e:Event ):void { // Triggered when the bookmark property of the cursor changes trace('bookmarkE, current='+cursor.current); trace('bookmarkE, bookmark='+cursor.bookmark.value); trace('bookmarkE, index='+cursor.bookmark.getViewIndex()); } public function test3( e:Event ):void { // Triggered when the cursor dispatches a cursor update event trace('Event, current='+cursor.current); trace('Event, bookmark='+cursor.bookmark.value); trace('Event, index='+cursor.bookmark.getViewIndex()); } private function _onClick():void { cursor.moveNext(); } ]]> </mx:Script> <mx:Button label="Move Cursor" click="_onClick()" themeColor="#FAFAFA" color="#FFFFFF" horizontalCenter="0" verticalCenter="20"/> </mx:Application>

