Access repeater element

Hello. I have one simple DataGrid with news listed. I have set a click event handler function for the DataGrid. My main app logic is based on viewstack. On one page of the viewstack I have the DataGrid mentioned above, on other I have this:


<mx:Accordion x="10" y="10" width="925" height="525" id="newsAc">
<mx:Repeater dataProvider="{frontNews}" id="newsRep">
<mx:Canvas label="{newsRep.currentItem.title}" width="100%" height="100%" id="repeaterCanvas">
<mx:Text x="0" y="0" text="{newsRep.currentItem.content}" width="100%" height="100%"/>
</mx:Canvas>
</mx:Repeater>
</mx:Accordion>

The datagrid fields are title and content - same as the repeater. What I want is when I click on news from the DataGrid to go to the same news in the Accordion to view the content. Up to now with no success :(.


objectStack.selectedIndex = 1; // viewstack's name
newsAc.selectedIndex = 4; // I am trying to use the selectedIndex method

Is there a way with for loop to find the index of the news I want of the Accordion?

Thank you in advance.