--- In [email protected], "Tracy Spratt" <[EMAIL PROTECTED]> wrote:
>
> Here is an example using getRepeaterItem() and getItemIndex()
> Tracy
> 
> <?xml version="1.0" encoding="utf-8"?>
> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; 
>     layout="absolute" 
>     creationComplete="initApp()">
> <mx:Script><![CDATA[
>   import mx.collections.ArrayCollection;
>   import mx.controls.Alert;
>   
>   [Bindable]private var _acDP:ArrayCollection;
>       
>       public function initApp():void
>       {
>         var oItem:Object;
>         _acDP = new ArrayCollection();
>         oItem = {Album:"The Lost Chord", Artist:"The Moody Blues", 
Price:"15.99", x:30, y:30 };
>         _acDP.addItem(oItem);
>         oItem = {Album:"Meddle", Artist:"Pink Floyd", 
Price:"17.99", x:170, y:60 };
>         _acDP.addItem(oItem);
>         oItem = {Album:"Trespass", Artist:"Genesis", Price:"18.99", 
x:220, y:100 };
>         _acDP.addItem(oItem); 
>         oItem = {Album:"In the Wake of Poseidon", Artist:"King 
Crimson", Price:"18.99", x:170, y:140 };
>         _acDP.addItem(oItem);
>         oItem = {Album:"Journey to the Center of the Earth", 
Artist:"rick Wakeman", Price:"18.99", x:30, y:110 };
>         _acDP.addItem(oItem);           
>  
>       }//initApp
>       
>       private function onClickItem(oEvent:Event):void
>       {
>         var oItem:Object = oEvent.currentTarget.getRepeaterItem();
>         var iIndex:int = _acDP.getItemIndex(oItem);
>         lblIndex.text = String(iIndex);
>       }//onClickItem
> 
>       
> ]]></mx:Script>
>   <mx:Label text="Clicked Item Index:" x="0" y="0" 
>       fontSize="14"  fontWeight="bold" />
>   <mx:Label id="lblIndex" x="160" y="0" 
>       fontSize="14" fontWeight="bold" color="red" />
>   <mx:Repeater id="rp" dataProvider="{_acDP}" >
>     <mx:LinkButton label="{rp.currentItem.Album}" click="onClickItem
(event)"
>         x="{rp.currentItem.x}" y="{rp.currentItem.y}"
>          />
>   </mx:Repeater>
> </mx:Application>

Thanks.  I'll see if I can get this to translate to my code. 

Reply via email to