1 Reply Latest reply on Apr 9, 2010 11:31 AM by kglad

    I need help with a rollover coding

    flashnightmare

      I have a flash that I am working on for the most part it is working. There are 13 texts that are named l1-l12, and pictures that go with these texts named 1-12. I have it to where the text for l1-l9 work and show the pictures 1-9, however when it gets to the double digits it doesn't work.

       

      l10, doesnt show any picture, l11 shows the picture that goes with l1, and l12, shows the picture that goes with l2. I have 2 other flash that work but the text and the images do not go into the double digits, they both stop at l8 and l6, and the coding is used for all three. The other two work with no problems, it is just the one that goes into the double digits that is having problems. Please help, I just need to finish this one problem. PLEASE and Thank you!

       

       

      the coding
      this._lockroot = true;
      var movieId:MovieClip = this;
      var numBtns:Number = 13;

      _quality="best";

      //handles the instruction statement
      var ii=0;
      info22._alpha = 0;
      info22.onEnterFrame = function() {
          if (ii <= 100) {
              ii += 2;
              info22._alpha = ii;
          } else {
              info22._alpha = 100;
              delete info22.onEnterFrame;
          }
      }


      //handles the button actions;
      for (var i=1; i<numBtns; i++){
          var btn:MovieClip = movieId["l"+i];
          btn.onRollOver = function () {
              var imageNum:String = this._name.charAt(this._name.length-1);
              var image:MovieClip = movieId[imageNum];
              image._visible = true;
              this.gotoAndStop(2);
              this._alpha = 100;
          }
          btn.onRollOut = function (){
              MenuTest();
          }
      }

      //run the MenuTest function to reset the buttons/images;
      MenuTest();

      function MenuTest () {
          for (var i=1; i<numBtns; i++) {
              var btn:MovieClip = movieId["l"+i];
              var image:MovieClip = movieId[i];
              // Reset Lesson colors
              // MyColorObject = new Color(this["l"+i]+[".myitem"]);
              // MyColorObject.setRGB(0x020053);
              btn.gotoAndStop(1);
              btn._alpha = 0;
              image._visible = false;
          }
          // Set Lesson Colors
          // MyColorObject = new Color(this["l"+i]+[".myitem"]);
          // MyColorObject.setRGB(0xD7A550);
           //trace ("TestName"+ TestName);

          //var swap = TestName.substr(1);
          //movieId[swap]._visible = true;
      }

      //make audio buttons on the start handle this animation;
      _parent._parent.playBtn.useHandCursor = true;
      _parent._parent.pauseBtn.useHandCursor = true;
      _parent._parent.replayBtn.useHandCursor = true;
      movieId.onEnterFrame = function(){
          _parent._parent.replayBtn.gotoAndStop("up");
          if (movieId._currentframe == movieId._totalframes) {
              movieId.stop();
              _parent._parent.playBtn._visible = false;
              _parent._parent.pauseBtn.enabled = false;
              _parent._parent.pauseBtn.gotoAndStop("disabled");
          } else if (movieId._currentframe > 1) {
              _parent._parent.pauseBtn.enabled = true;
              _parent._parent.pauseBtn.gotoAndStop("up");
          }
          if (_parent._parent.pauseBtn._currentframe < 39){
              _parent._parent.pauseBtn.onPress = function(){
                  movieId.stop();
              }
          }

          _parent._parent.playBtn.onPress = function(){
              movieId.play();
          };

          _parent._parent.replayBtn.onPress = function(){
              instruction_mc.hideInst();
              movieId.gotoAndStop(1);
              movieId.gotoAndPlay(1);
          };
          delete movieId.onEnterFrame;
      }
        • 1. Re: I need help with a rollover coding
          kglad Adobe Community Professional & MVP

          if there are thirteen anything, you have a problem because you're looping thru 12 items.

          what's the following show when rolling over the problematic buttons.

           

          //handles the button actions;

           

          for (var i=1; i<numBtns; i++){

           

               var btn:MovieClip = movieId["l"+i];

           

              btn.onRollOver = function ()  {

           

                  var imageNum:String =  this._name.charAt(this._name.length-1);

           

                  var image:MovieClip =  movieId[imageNum];

          trace(imageNum+" "+image);

                  image._visible = true;

           

                   this.gotoAndStop(2);

           

                  this._alpha = 100;

           

              }

           

               btn.onRollOut = function (){

           

                  MenuTest();

           

              }

           

          }