3 Replies Latest reply on Apr 12, 2011 12:29 PM by MadMich

    reset case statement

    MadMich Level 1

      Below is part of a case statement that moves an object in increments of 5.

      How do I tell each case to begin at the 'Reset' postion?

       

      var d = this.getField("Step1.0.1");
      var e = this.getField("Step1.1.1");
      var f = this.getField("Step1.2.1");

       

      var bFields = [d,e,f,q,m,o];

       

      switch (event.value) {

       

      case "Reset":
          d.rect = [474.31298828125,505.59600830078125,602.52197265625,450.64898681640625];
          e.rect = [474.31298828125,449.385986328125,602.52197265625,394.4389953613281];
          f.rect = [474.31298828125,393.1759948730469,602.52197265625,338.22900390625];

       

      case "10%":   
      for(j = 0; j < bFields.length; j++) {
      var bRect = bFields[j].rect;
      bRect[1] -= 5;
      bRect[3] -= 5;
      bFields[j].rect = bRect}
      break;

       

      case "20%":   
      for(j = 0; j < bFields.length; j++) {
      var bRect = bFields[j].rect;
      bRect[1] -= 10;
      bRect[3] -= 10;
      bFields[j].rect = bRect}
      break;

       

      case "30%":   
      for(j = 0; j < bFields.length; j++) {
      var bRect = bFields[j].rect;
      bRect[1] -= 15;
      bRect[3] -= 15;
      bFields[j].rect = bRect}
      break;

      }

       

      Cheers fo looking