4 Replies Latest reply on Jan 12, 2009 7:27 AM by clbeech

    Tween with scale effect

    Patel Bharat Level 2
      Hi,

      I have a movieclip which will be placed at random place ( when the flash movie is loaded ). Now when i click on the movie i want the movie should move to center point with the effect of scaling. But the issue is that it's not placed at center.

      I had used tween to move the movie at center place.

      Can anyone help me !!

      Thanks In Advance.
        • 1. Re: Tween with scale effect
          kglad Adobe Community Professional & MVP
          what tween did you use and where's the movieclip's registration point?
          • 2. Re: Tween with scale effect
            Patel Bharat Level 2
            On movie click at to send the movie clip i had used the tween as :

            var centerX:Number = Stage.width/2 - this._width/2;
            var centerY:Number = Stage.height/2 - this._height/2;

            var centerxTween = new mx.transitions.Tween(this, "_x", mx.transitions.easing.Regular.easeIn, this._x, centerX, 0.5, true);
            var centeryTween = new mx.transitions.Tween(this, "_y", mx.transitions.easing.Regular.easeIn, this._y, centerY, 0.5, true);

            var xTween:Tween = new mx.transitions.Tween(this, "_xscale", mx.transitions.easing.Regular.easeIn, this._xscale, this._xscale + 70, 30, false);
            var yTween:Tween = new mx.transitions.Tween(this, "_yscale", mx.transitions.easing.Regular.easeIn,this._yscale, this._yscale + 70, 30, false);

            The movie clip registration point is "center". ( exactly i was thinking on movieclip registration...)

            • 3. Re: Tween with scale effect
              Patel Bharat Level 2
              On movie click to send the movie clip i had used the tween as :

              var centerX:Number = Stage.width/2 - this._width/2;
              var centerY:Number = Stage.height/2 - this._height/2;

              var centerxTween = new mx.transitions.Tween(this, "_x", mx.transitions.easing.Regular.easeIn, this._x, centerX, 0.5, true);
              var centeryTween = new mx.transitions.Tween(this, "_y", mx.transitions.easing.Regular.easeIn, this._y, centerY, 0.5, true);

              var xTween:Tween = new mx.transitions.Tween(this, "_xscale", mx.transitions.easing.Regular.easeIn, this._xscale, this._xscale + 70, 30, false);
              var yTween:Tween = new mx.transitions.Tween(this, "_yscale", mx.transitions.easing.Regular.easeIn,this._yscale, this._yscale + 70, 30, false);

              The movie clip registration point is "center". ( exactly i was thinking on movieclip registration...)

              • 4. Re: Tween with scale effect
                clbeech Level 3
                looks like the issue may be the order of operation in the center calc. you can also save yourself a lot of headaches by 'importing' the class previous to the calls - more like this: