7 Replies Latest reply on Sep 6, 2007 1:55 PM by kglad

    converting values for scaling

    influxxmedia Level 1
      Hi

      I need to map one set of values to another to control the scaling of an MC.
      I need the _y value of 482 to equal 15% _yscale, and the _y value to equal 100% _yscale.

      The code I fudged so far goes:
      this.scanner_mc.onEnterFrame = function(){
      this._x = _root._xmouse;
      updateAfterEvent();
      }
      this.beam_mc.onEnterFrame = function(){
      this._x = _root._xmouse;
      this._yscale = stretch;
      stretch = laser_mc._y * -.41+215;
      trace("STR="+stretch);
      trace("MCY="+laser_mc._y);
      updateAfterEvent();
      }

      this.laser_mc.startDrag(true, 80, 240, 660, 500);

      I basically guessed at the values for 'stretch' but I know there has to be a smart trigonometry way of calculating it.

      It is easier if I show you, so I posted an SWF/FLA so you can see what I am trying to acheive and the code I have used so far to get there.

      http://dev.binaryinteractive.com/public/scanner.swf
      http://dev.binaryinteractive.com/public/scanner.fla

      many thanks
      mm66