0 Replies Latest reply on Oct 26, 2009 10:52 PM by irti

    change hover animation to click using actionscript 2.0...help

    irti Level 1

      the following actionscript is for an accordion style menu which opens up when u hover on a particular area of the region...i wanted to change it to a clickable area....basically i want the accordion animation to start when i click on that particular region...any help would be appreciated...thanks a lot for your time....

       

      stop();
      speed = 10;
      initial_width = 75;
      target_width = 450;
      sp = rect1._x;
      this.createEmptyMovieClip("emptymc", 0);
      emptymc.onEnterFrame = function() {   
      for (i=1; i<=6; i++) {
          if (_root.hit.hitTest(_root._xmouse, _root._ymouse, true)) {
              if (_root["rect"+i].hitTest(_root._xmouse, _root._ymouse, true)) {
                  new_x = (_root.sp-(75*(i-1)))-rect1._x;
                  rect1._x += new_x/speed;
                  n_width = target_width-_root["rect"+i]._width;
                  _root["rect"+i]._width += n_width/speed;
              } else {
                  n_width2 = initial_width-_root["rect"+i]._width;
                  _root["rect"+i]._width += n_width2/speed;
              }
          } else {
              new_x = _root.sp-rect1._x;
              rect1._x += new_x/(speed+50);
              n_width2 = initial_width-_root["rect"+i]._width;
              _root["rect"+i]._width += n_width2/(speed-1);
          }
          _root["rect"+(i+1)]._x = _root["rect"+i]._x+_root["rect"+i]._width;
          _root["movie"+i]._x = _root["rect"+i]._x-1;
          }
      };

       

       

       

      ps am also attaching the swf file so u can see for yourself how this works