6 Replies Latest reply on Jan 31, 2007 8:48 PM by jahmer

    can this be done with an better with an Array?

    Level 7
      I have the following function, which turns on all buttons in my movie,
      and I am wondering if that could be done better, with less code.

      function enableBtns(){
      this.nav1.about_btn.enabled = true;
      this.nav1.production_btn.enabled = true;
      this.nav1.reel_btn.enabled = true;
      this.nav1.clients_btn.enabled = true;
      this.nav1.case_studies_btn.enabled = true;
      this.nav1.client_access_btn.enabled = true;
      this.nav1.contact_btn.enabled = true;


      I was wondering about something like this?

      function enableBtns(){
      var sbuttonPath:MovieClip = this.nav1;

      var mybuttons:Array = new Array();
      mybuttons[about_btn, production_btn, reel_btn, clients_btn,
      case_studies_btn, contact_btn, client_access_btn];

      //somehow enable each button that is in the array, which is what //I
      don't know how to do?

      Thank you for any help with this!