4 Replies Latest reply on Aug 22, 2006 2:42 PM by enginpost

    onRollOver = onRollOut equivalent

    Shayne_Jackson
      I'm looking to condense some code on a photo gallery I'm working on where I disable the next or previous buttons if there isn't a next or previous image to present. I wanted to break away from the standard multiple line approach...

      nextBTN_mc.onRollOver = function() {
      this.gotoAndStop(1);
      }
      nextBTN_mc.onRollOut = function() {
      this.gotoAndStop(1);
      }
      nextBTN_mc.onRelease = function() {
      this.gotoAndStop(1);
      }

      or

      nextBTN_mc.onRollOver = function() {
      this.gotoAndStop(1);
      }
      nextBTN_mc.onRollOut = nextBTN_mc.onRollOver;
      nextBTN_mc.onRelease = nextBTN_mc.onRollOver;

      Once upon a time (and I'm not sure where), I saw someone post a one line solution to this. Something like (but not):

      nextBTN_mc.onRollOver([{'onRollOut', 'onRelease'}]) = function() {
      this.gotoAndStop(1);
      }

      The syntax on the above is of course wrong but the solution I saw once was similar to this. The "([{'onRollOut', 'onRelease'}])" (or similar) may have been after the function parameters and there is probably an operator that I'm forgetting/missing. I've played around with it and searched the net but can't seem to get it to work or find it.

      Anyways, if anyone out there knows the solution, I'd really appreciate a response. It was a very clever, clean and condensed solution and I'd love to find it again.

      Take care,
      sej