5 Replies Latest reply on Oct 10, 2006 3:20 AM by Ankur Arora

    dissable the onRollOver action after first onRollOver

    rohai
      Hi,

      is it possible to dissable the onRollOver action after the user rolls over the first time? I have a menu, which loads a external SWF into a MC and after click the loaded swf plays. In menu are five item and each one load different swf. What I want is to prevent the onRollOver action after the first onRollOver, because right now it load swf again even if it's already loaded. But onRollOver should work again after the onRelease or after user rolls over other button.

      THX for any tips.
        • 1. Re: dissable the onRollOver action after first onRollOver
          Level 7
          Hi!

          You can just delete teh onRollOver function like in the example below.

          I've made a movieclip and given it instance name B. Then I've placed this
          code in a frame on the same timeline as I placed the movieclip.

          B.onRollOver = function() {
          this._alpha = this._alpha/2; // just an example of something to
          do
          delete this.onRollOver; // comment out this code to
          compare
          }

          /Jensen/

          "rohai" <webforumsuser@macromedia.com> wrote in message
          news:egdbod$dvp$1@forums.macromedia.com...
          > Hi,
          >
          > is it possible to dissable the onRollOver action after the user rolls over
          > the
          > first time? I have a menu, which loads a external SWF into a MC and after
          > click
          > the loaded swf plays. In menu are five item and each one load different
          > swf.
          > What I want is to prevent the onRollOver action after the first
          > onRollOver,
          > because right now it load swf again even if it's already loaded.
          >
          > THX for any tips.
          >


          • 2. dissable the onRollOver action after first onRollOver
            rohai Level 1
            Hi,
            Jensen, THX for your help. I didn't think it takes only one line. But another problem appeared. I also have a blur action which happens onRollOver, but this one I don'T want to kill. I just want the Actions[this.actionA](this.movieclip); part to disable. Here's my onRollOver code:

            • 3. Re: dissable the onRollOver action after first onRollOver
              Ankur Arora Level 1
              Jensen is bit right, but in his case you would not be able to call onRollOver event when you come back on a button from some other button. So it would be better to take some variable and updating it's value like:-
              var currentMC:String ;
              my_btn1.onRollOver = function(){
              if(currentMC!="my_btn1"){
              load_mc.loadMovie("abc1.swf");
              currentMC = "my_btn1";
              }
              }
              my_btn2.onRollOver = function(){
              if(currentMC!="my_btn2"){
              load_mc.loadMovie("abc2.swf");
              currentMC = "my_btn2";
              }
              }

              if you are creating menu inside a loop and it's events are also inside that loop, then use code like this:-
              for(i=1;i<=2;i++){
              eval("my_btn"+i).onRollOver = function(){
              if(currentMC!=("my_btn"+i)){
              load_mc.loadMovie("abc1.swf");
              currentMC = ("my_btn"+i);
              }
              }
              }

              Regards
              Ankur
              • 4. Re: dissable the onRollOver action after first onRollOver
                rohai Level 1
                Ankur Arora, THX for your reply and yes, you are right. Where do I put your code? In a loop that creates menu?

                Here's my code
                • 5. Re: dissable the onRollOver action after first onRollOver
                  Ankur Arora Level 1
                  please check the below