1 Reply Latest reply on Apr 16, 2006 5:54 AM by blemmo

    button that runs 2 actionscripts

    StevenRAN
      bc.onRollOver = function() {
      if (_root.section != "images/bc_sample.jpg") {
      _root.section = "images/bc_sample.jpg";
      _root.transition.gotoAndPlay("closing");
      }
      };

      Above is the code I have on frame 2. It allows my button bc to work.
      It works fine, but I want button bc to do two things.


      // FIRST THING //
      bc.onRollOver = function() {
      if (_root.section != "images/bc_sample.jpg") {
      _root.section = "images/bc_sample.jpg";
      _root.transition.gotoAndPlay("closing");
      }
      };


      //AND//

      // SECOND THING //
      bc.onRollOver = function() {
      if (_root.section != "images/bc_self.jpg") {
      _root.section = "images/bc_self.jpg";
      _root.trans2.gotoAndPlay("close");
      }
      };

      HOW DO I TIE THEM TOGETHER SO THE BUTTON "bc" does both.
      I am not very good at flash and I do not know how to make this work.
        • 1. Re: button that runs 2 actionscripts
          blemmo Level 1
          Just connect them with a 'else', although I think it's not logical if there are more than 2 possibilities... What should happen if root.section == "images/bc_something" (if that's possible in your movie)?
          Anyway, this is how it looks:

          bc.onRollOver = function() {
          if (_root.section != "images/bc_sample.jpg") {
          _root.section = "images/bc_sample.jpg";
          _root.transition.gotoAndPlay("closing");
          }
          else if (_root.section != "images/bc_self.jpg") {
          _root.section = "images/bc_self.jpg";
          _root.trans2.gotoAndPlay("close");
          }
          };

          This code would change the pic to bc_sample.jpg, if it was bc_self.jpg before. Is that what you want? If you leave out he 'else', it would change to bc_sample.jpg and right after that back to bc_self.jpg in the same case.

          hth,
          blemmo