I have a datagrid populated with Objects (representing .pdfs) who all share an "indexed" property (indexed in a SQL table). If they are indexed, their respective checkbox is checked and indexed is set to true. I also have a button in my window, that when clicked, the selected objects are called to be indexed.
The problem is that if some are already indexed, I should prompt the user to decide what to do. Ignore (dont do anything) or Replace (delete in table and re-index). This is what I tried but all it does is stack the windows and continues to index them all.
private function indexPDFData(evt:MouseEvent):void //button handler
{
var i:int=0;
if(pdfScreen.grid2.selectedIndices.length>0) //if items are selected
{
for each(var item:Object in pdfScreen.grid2.selectedItems)
{
if(item.indexed=="true")
{
var window:CustomPopUp = PopUpManager.createPopUp(pdfScreen, CustomPopUp, true) as CustomPopUp;
window.ignoreBtn.addEventListener(MouseEvent.CLICK, ignore);
window.replaceBtn.addEventListener(MouseEvent.CLICK, replace);
}
}
sendNotification(ApplicationFacade.COMMAND_INDEX_PDFS, (pdfScreen.grid2.selectedItems));
pdfScreen.controlBtns.enabled=false;
}
else
{
Alert.show("Must select an issue to index!", "Index PDFs");
}
}
What I would like is the loop to stop while the user makes a choice, and continue after he has clicked on of the two choices inside the popup window. I've tried many approaches but none of them work. I'm pretty new to as3 so any help or insight would really be appreciated!