2009-12-30 25 views

回答

0

Datagrid的應該是這樣的:

<mx:DataGrid id="DataGridAnswers" 
       top="10" bottom="10" left="10" right="10" 
       > 
     <mx:columns> 
      <mx:DataGridColumn> 
       <mx:itemRenderer> 
        <fx:Component> 
         <mx:LinkButton label="Посмотреть результат" 
             click="linkbutton1_clickHandler(data.test_id, data.id)"> 
          <fx:Script> 
           <![CDATA[ 
            import etc.NavigationEvent; 
            protected function linkbutton1_clickHandler(testId:int, answerId:int):void 
            { 
             var navEvent:NavigationEvent = 
              new NavigationEvent(NavigationEvent.NAVIGATION_STRING, 
               NavigationEvent.REPORTS_SCREEN, true, true); 
             navEvent.testId = testId; 
             navEvent.answerId = answerId; 
             dispatchEvent(navEvent); 
            } 
           ]]> 
          </fx:Script> 
         </mx:LinkButton> 
        </fx:Component> 
       </mx:itemRenderer> 
      </mx:DataGridColumn> 
     </mx:columns> 
    </mx:DataGrid> 

而且在容器處理此事件是這樣的:

protected function navigationHandler(event:NavigationEvent):void 
      { 
       // выбрать соответвтующий экран на главном меню 
       mainMenu.selectScreen(event.screen); 

       switch (event.screen) 
       { 
        case NavigationEvent.LOGOUT: 
                 ... 
         break; 

       } 

       // Переключить вью стек 
       if (screenDic[event.screen] != null) 
        viewStack_main.selectedChild = screenDic[event.screen]; 
      } 

加上添加事件偵聽到容器

initialize="this.addEventListener(NavigationEvent.NAVIGATION_STRING, navigationHandler)" 
+0

謝謝...它真的有幫助 – Anupama 2009-12-30 11:08:48

+1

你能把它標記爲答案嗎? – Egor 2009-12-30 11:42:48