Current Index in a Repeater
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical"> <mx:Script> private function getBookData(evt:Event):void{ nameLabel.text = evt.target.getRepeaterItem(); } </mx:Script> <mx:Model id="bookData"> <books> <bookName>A</bookName> <bookName>B</bookName> <bookName>C</bookName> </books> </mx:Model> <mx:ArrayCollection id="bookArray" source="{bookData.bookName}" /> <mx:Repeater id="bookRepeater" dataProvider="{bookArray}"> <mx:Label text="{bookRepeater.currentIndex + 1} {bookRepeater.currentItem}" /> <mx:Button label="Add to Cart" click="getBookData(event)" /> </mx:Repeater> <mx:Label id="nameLabel" fontSize="14" /> </mx:Application>