1 Reply Latest reply on Oct 30, 2008 3:05 PM by cmarlo

    Loop through dynamic clips, attach rollover

    cmarlo
      I'm trying to apply a rollOver function to 15 movie clip slides without having to manually write a script for each one. I thought I would be able to do this with a simple for loop, and dynamically calling the instance, but no luck. Any thoughts? Many thanks to anyone who can illuminate a solution.

      for (i=1;i<=15;i++) {
      this["slide" + i].grip_rt.onRollOver = function() { this["slide" +i].rotate_arrow_tr.gotoAndStop(2); }
      }
        • 1. Re: Loop through dynamic clips, attach rollover
          cmarlo Level 1
          I figured out my solution. I was able to pass a variable from inside the loop to an outside function which I should have done in the first place. If it helps others, here it is. Still getting a grip on this stuff.

          function showArrow_tr(arrow_tr) {
          this["slide" + arrow_tr].rotate_arrow_tr.gotoAndStop(2);
          }

          for(var i=1; i<=3; i++) {
          this['slide'+i].grip_rt.num = i;
          this['slide'+i].grip_rt.onRollOver = function() {
          arrow_tr = this.num;
          showArrow_tr(arrow_tr);
          }
          }