3 Replies Latest reply on Jul 9, 2006 6:55 PM by CJ_Dennis

    on (rollOver) - loop action

    mr.nazarko
      hey ,

      is it possible to loop an action activated by a rollover?
      my current script will only run once...

      how do you set up an "if" statement... so that when rolling over a button, an action will loop until i rollout?

      any help is appreciated

      thanks,
      nazarko

        • 1. Re: on (rollOver) - loop action
          Level 7


          mr.nazarko wrote:
          > hey ,
          >
          > is it possible to loop an action activated by a rollover?
          > my current script will only run once...
          >
          > how do you set up an "if" statement... so that when rolling over a button, an
          > action will loop until i rollout?
          >
          > any help is appreciated

          bit too general, you will need to show us what action you are trying to loop


          --
          Regards

          Urami


          --



          Happy New Year guys - all the best there is in the 2006 :)




          <urami>
          http://www.Flashfugitive.com
          </urami>

          <web junk free>
          http://www.firefox.com
          </web junk free>
          • 2. Re: on (rollOver) - loop action
            mr.nazarko Level 1
            hey
            thanks!

            here is the code im trying to loop....


            on (rollOver) {
            if (_root.mainVar == 0) {
            homeX = (-_root._xmouse*2.2)+1300;
            } else {
            homeX = (-_root.mainVar*2.2)+1300;
            }
            thisX = grass._x;
            diffX = homeX-thisX;
            if (_root.mainVar == 0) {
            moveX = diffX/60;
            } else {
            moveX = diffX/40;
            }
            grass._x = thisX+moveX;

            }
            and ive posted a rough example

            http://www.popmontreal.com/TEST/

            the background is the effect im trying to achieve...

            also, i just realized im going to have a button overlaying another button...
            is it possible to have both active...
            or does the large rollover cancel out the imbedded ones ?

            thanks !
            anton

            • 3. Re: on (rollOver) - loop action
              CJ_Dennis
              on (rollOver) executes only once whenever the mouse hits the object, not continuously. You would need to set up a condition [e.g. myButtonActive=true;] that you then check in _root.onEnterFrame [e.g. if (myButtonActive) {...}]. Your condition will then be checked 12 times a second or whatever value you have set for fps. Make sure you remove the condition when you roll out [e.g. myButtonActive=false;].
              Only one of your buttons can receive on (rollOver) at a time. I think you can call your event from within your code but I can't check this right now. Maybe something like