3 Replies Latest reply on Oct 3, 2011 4:23 PM by kglad

    maintaining ._yscale

    Ron Colmen Level 2

      There is an moviclip attached to a textfield. when the movieclip is being moved (holding the mouse down) the textfield scales.

       

      The textfield and the moviclip button is inside a movieclip. When scalling the button tend to move away from the textfield. How do I maintain the ._y of the movieclip button stay attached to the textfield when scaling?

       

      1.jpg

       

      tfNum_mc.resize.onPress = function(){

              this._parent.swapDepths(this._parent._parent.getNextHighestDepth());

              goBacktoOrig(this.parent.tf)

              removeTT(this._parent.tooltip);

              this.startX = this._x;

              this.startY = this._y;

              this.w = this._parent.tf._width;

              this.h = this._parent.tf._height

              this.sx = this._parent.tf._xscale;

              this.sy = this._parent.tf._yscale

              this.onEnterFrame = resizeTFF;

              this.startDrag();

          }

          tfNum_mc.resize.onRelease=tfNum_mc.resize.onReleaseOutside=function(){

              this.stopDrag();

              delete this.onEnterFrame;

       

          this._x = (this._parent.tf._x+this._parent.tf._width/2)-this._width;

          this._y = (this._parent.tf._y+this._parent.tf._height)-this._parent.tf._height/4; //How do I maintain the _y of the movieclip button stay attached to the textfield when scaling?

          }

       

       

      function resizeTFF():Void{

          var cx:Number = this._parent._xmouse-this.startXmous;

          var cy:Number = this._parent._ymouse-this.startYmous;

          var scaleX:Number = this.sx+this.sx*(this._x-this.startX)/this.w;

          var scaleY:Number = this.sy+this.sy*(this._y-this.startY)/this.h;

       

          if(scaleX>0 && scaleY>0){

              if(scaleX/scaleY>this.aspectRatio){

                  this._parent.tf._xscale = scaleX;

                  this._parent.tf._yscale = this.sy*scaleX/this.sx

              } else {

                  this._parent.tf._yscale = scaleY;

                  this._parent.tf._xscale = scaleY*this.sx/this.sy

              }

          } else {

              this.onRelease();

          }

          this._parent.tf._x = -this._parent.tf._width/2;

          this._parent.tf._y = -this._parent.tf._height/2;

       

          this._x = (this._parent.tf._x+this._parent.tf._width/2)-this._width;

          this._y = this._y; //How do I maintain the _y of the movieclip button stay attached to the textfield when scaling?

      }