2 Replies Latest reply on Oct 15, 2007 12:55 PM by posterboy

    help with shortening code

    posterboy
      i need help with some code. the movie works great when the code is written for each button...

      btn_group_mc.landing_btn.onRelease = function(){
      btn_group_mc.launch_btn.enabled=true;
      launchButtons2="landing";
      gotoAndPlay(2);
      }

      btn_group_mc.omdp_btn.onRelease = function(){
      btn_group_mc.launch_btn.enabled=true;
      launchButtons2="omdp";
      gotoAndPlay(2);
      }

      btn_group_mc.rollover_btn.onRelease = function(){
      btn_group_mc.launch_btn.enabled=true;
      launchButtons2="rollover";
      gotoAndPlay(2);
      }

      the problem is when i shorten it up to include all three buttons...

      function launchPicBtn (item) {
      btn_group_mc[item+"_btn"].onRelease = function() {
      btn_group_mc[item+"_btn"].enabled=true;
      launchButtons2=[item]; /// i'm almost certain the problem is here. the variable stops working.
      gotoAndPlay(2);
      }
      }

      launchPicBtn("landing")
      launchPicBtn("omdp")
      launchPicBtn("rollover")

      any ideas?