4 Replies Latest reply on Feb 21, 2012 8:05 AM by DMB89

    single function for multiple buttons

    DMB89

      Hi there

       

      My problem is that I am trying to use the following functions on 10 different logo movieclips. Each logo movieclip has a popup up box (another mc) within its timeline with a description in. When I hover over the logo movieclip i want it to call the forward frames function and on hover out call the rewindframes function.


      function forwardFrames() {

          onEnterFrame = function () {

              if (_currentframe != 15) {

                  nextFrame();

              } else {

                  stop();

                  delete this["onEnterFrame"];

              }

          };

      }

      function rewindFrames() {

          onEnterFrame = function () {

              if (_currentframe != 1) {

                  prevFrame();

              } else {

                  stop();

                  delete this["onEnterFrame"];

              }

          };

      }

       

      However i am trying to do all this on the main timeline and the only way i can think to make it currently work is if i do the following for every logo mc which, surely there is a better way:

       

      symbol_1.onRollOver = function() {

           symbol_1.onEnterFrame = function () {

                if (symbol_1._currentframe != 15) {

                          symbol_1.nextFrame();

                } else {

                     symbol_1.stop();

                     delete this["onEnterFrame"];

                }

           };

      }

       

      symbol_1.onRollOut = function() {

           symbol_1.onEnterFrame = function () {

                if (symbol_1._currentframe != 1) {

                     symbol_1.prevFrame();

                } else {

                     symbol_1.stop();

                     delete this["onEnterFrame"];

                }

           };

      }

       

      Any advise would be much appriciated, thankyou

       

      Daniel