1 Reply Latest reply on Aug 21, 2007 2:06 AM by Greg Dove

    Need some easy (i think) help.

    Eatstatic
      Yesterday i wrote this "for" loop to activate four buttons:

      for (var i:int = 1; i<5; i++) {
      this["button" + i].addEventListener(MouseEvent.MOUSE_OVER, overHandler);
      this["button" + i].addEventListener(MouseEvent.MOUSE_OUT, outHandler);
      this["button" + i].addEventListener(MouseEvent.CLICK, clickHandler);

      Not i want to activate four more, but the are nested in another movieclip

      my code looks like this now:

      border.button5.addEventListener(MouseEvent.MOUSE_OVER, overBorderHandler);
      border.button5.addEventListener(MouseEvent.MOUSE_OUT, outBorderHandler);
      border.button5.addEventListener(MouseEvent.CLICK, clickBorderHandler);
      border.button6.addEventListener(MouseEvent.MOUSE_OVER, overBorderHandler);
      border.button6.addEventListener(MouseEvent.MOUSE_OUT, outBorderHandler);
      border.button6.addEventListener(MouseEvent.CLICK, clickBorderHandler);
      border.button7.addEventListener(MouseEvent.MOUSE_OVER, overBorderHandler);
      border.button7.addEventListener(MouseEvent.MOUSE_OUT, outBorderHandler);
      border.button7.addEventListener(MouseEvent.CLICK, clickBorderHandler);
      border.button8.addEventListener(MouseEvent.MOUSE_OVER, overBorderHandler);
      border.button8.addEventListener(MouseEvent.MOUSE_OUT, outBorderHandler);
      border.button8.addEventListener(MouseEvent.CLICK, clickBorderHandler);

      I dont know the how to write the code when the objects are nested in the "border" movieclip...

      I have tried some variety.... like:

      this["border.button" + i]....
      or
      border.this["button"+i]....

      But it wont work, can someone please guide me in the right direction =)