5 Replies Latest reply on Sep 23, 2011 4:27 AM by Ned Murphy

    problem on rollOver event in as2

    ayrusshine

      Hi,

          I am doing some interactive file when i click a movieClip it should stop at frame 4 and when it is roll over it goto frame2 and when i roll Out it should come back to frame 1. But the problem is when i click a movie clip it should no roll out. please me help me

        • 1. Re: problem on rollOver event in as2
          Ned Murphy Adobe Community Professional & MVP

          Show the code you are using for the movieclip.

          • 2. Re: problem on rollOver event in as2
            ayrusshine Level 1

            for(i=0; i<3; i++){

                      this["myClip"+i].onRollOver = function() {

                                this.gotoAndStop(3);

                      }

             

                      //this["myClip"+i].onRollOut = function() {

            //                    this.gotoAndStop(1);

            //          }

             

                      this["myClip"+i].onRelease = function() {

             

                                this.gotoAndStop(4);

                      }

            }

             

            Here i have commented the rollOut function

            • 3. Re: problem on rollOver event in as2
              Ned Murphy Adobe Community Professional & MVP

              If I understand the problem, try:

               

              for(i=0; i<3; i++){

                        this["myClip"+i].onRollOver = function() {

                                  this.gotoAndStop(3);

                        }

               

                        this["myClip"+i].onRollOut = function() {

                                 this.gotoAndStop(1);

                        }

               

                        this["myClip"+i].onRelease = function() {

                                  delete this.onRollOut;

                                  this.gotoAndStop(4);

                        }

              }

              1 person found this helpful
              • 4. Re: problem on rollOver event in as2
                ayrusshine Level 1

                what should i do when again i want the onRollOut on some other instance for eg: when i click the second myClip2 i want the rollOut on the myClip1

                • 5. Re: problem on rollOver event in as2
                  Ned Murphy Adobe Community Professional & MVP

                  You will want to have a function that reassigns all of the rollouts, and then call that function before you remove the rollout from the current button...

                   

                  function assignRollouts(){   

                      for(i=0; i<3; i++){

                          this["myClip"+i].onRollOut = function() {

                            this.gotoAndStop(1);

                          }

                      }

                  }

                   

                  assignRoollouts();

                   

                  for(i=0; i<3; i++){

                            this["myClip"+i].onRollOver = function() {

                                      this.gotoAndStop(3);

                            }

                   

                            this["myClip"+i].onRelease = function() {

                                      assignRollouts()

                                      delete this.onRollOut;

                                      this.gotoAndStop(4);

                            }

                  }

                  1 person found this helpful