2013-06-19 6 views
0

SQL 테이블에 인덱싱 된 "인덱싱 된"속성을 모두 공유하는 Objects (.pdfs)로 채워진 DataGrid가 있습니다. . 인덱스가 지정되면 해당 확인란이 선택되고 인덱스가 true로 설정됩니다. 내 윈도우에도 버튼을 클릭하면 선택한 객체가 인덱싱되도록 호출됩니다.코드 실행을 계속하지 않고 루프에서 (팝업 창을 통해)

일부 문제가 이미 색인 된 경우 사용자에게 수행 할 작업을 결정하라는 메시지를 표시해야합니다. 무시 (아무 것도하지 않음) 또는 바꾸기 (표에서 삭제하고 색인 다시 생성). 이것은 내가 시도한 것이지만 모든 것은 창을 쌓아서 모두 색인화를 계속합니다.

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");  
     } 
    } 

은 내가 이 원하는 것은 사용자가 선택하게하는 동안 중지, 그가 팝업 창 내부의 두 가지 선택의를 클릭 한 후 계속 루프입니다. 나는 많은 접근법을 시도했지만 그들 중 누구도 일하지 않습니다. 나는 as3에 꽤 익숙해 져서 어떤 도움이나 통찰력이라도 정말 고맙게 생각할 것입니다!

답변

0
private var currentIndex:int;//used to remember the index of the item whose indexed is true 

private function indexPDFData(evt:MouseEvent):void //button handler 
{ 
    if(pdfScreen.grid2.selectedIndices.length>0) // 
    { 
     checkItems(0); 
    } 
    else 
    { 
     Alert.show("Must select an issue to index!", "Index PDFs");  
    } 

} 

private function checkItems(startIndex:int):void { 

    for (var i:int = startIndex; i < pdfScreen.grid2.selectedItems.length; i++) 
    { 
      var item:Object = pdfScreen.grid2.selectedItems[i]; 

      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); 
       currentIndex = i;//call checkItems(currentIndex + 1) when close window 
       break; 
      } 
    } 

    sendNotification(ApplicationFacade.COMMAND_INDEX_PDFS, (pdfScreen.grid2.selectedItems)); 
    pdfScreen.controlBtns.enabled=false; 
} 

창 (CustomPopUp)을 닫을 때 checkItems (currentIndex + 1);

+0

정말 멋지다! break가 호출 될 때를 제외하고는 거의 효과가있었습니다. 즉, 팝업을 사용해도 바로 인덱싱으로 이동합니다. 그러나 그것은 올바른 방향으로 나를 이끌어 내고 작동합니다 : D. currentIndex가 끝에 있는지 확인하기 위해 루프 앞에 if 문을 추가했습니다. 그 이후이면 인덱싱 프로세스가 시작됩니다. 정말 감사! – user1819615

+0

break를 return으로 대체해야합니다. :) – Pan