0 Replies Latest reply on May 16, 2007 1:34 AM by dandanalias

    Magnifying...

    dandanalias
      Hi I am doing this course but I think that there is something worng with this code can anyone tell me if the code is right



      quote:

      // this makes the mask follow the magnifying glass
      magnifiermask._x = magnifyingglass._x;
      magnifiermask._y = magnifyingglass._y;
      // this scales up the image according to the magnification variable, mag
      scaledimage._xscale = mag;
      scaledimage._yscale = mag;
      // this places the scaled image in the correct spot
      // (original._x-magnifiermask._x) tells us where the glass is "relative to the centre of the original"
      scaledimage._x = mag/100*(original._x-magnifiermask._x) + magnifiermask._x;
      scaledimage._y = mag/100*(original._y-magnifiermask._y) + magnifiermask._y;
      if(Key.isDown(key.Up)) {
      mag= mag * 1.01;
      }
      if((Key.isDown(key.Up))&&(Key.isDown(key.SHIFT))) {
      mag= mag * 1.05;
      }
      if(Key.isDown(key.Down)) {
      mag= mag / 1.01;
      }
      if((Key.isDown(key.Down))&&(Key.isDown(key.SHIFT))) {
      mag= mag / 1.05;
      }