2 Replies Latest reply on Mar 8, 2010 12:14 PM by JohnMerlino

    referencing flex buttons in the actionscript CDATA

    JohnMerlino Level 1

      Hey all,

      I have two flex buttons:

      <s:Button includeIn="Detail" x="60" y="329"
      label="Pass"
      click="studentsPass.send(studentsGrid.selectedItem  )" />

      <s:Button includeIn="Detail" x="150" y="329"
      label="Fail"
      click="studentsFail.send(studentsGrid.selectedItem  )" />

      I would like to use actionscript to limit visibility based on the state (e.g. pass/fail) of an xml element value:

      <students>
      <student>
      <student_state>passed</student_state>
      </student>
      </students>

      What I would like to do is loop through the buttons:

      for(var i:Number = 0; i < buttons.length; b++) {

      if (element.student_state == passed)
      btn1._visibility = false;
      btn2._visibility = true;
      }

      But seeing that the buttons in flex don't have instance names like btn1, I'm not sure how to reference the buttons. Thanks for any suggestions.