I did some tests here with one rectangle and I think it is related to the mc
origin point
When one tween scales it, it grows from its left upper corner but the
another tween "doesn´t know" about the changes and make the movement based
on the original position.
So you have to use onMotionChanged to get each ._width after each scale and
then center at the same time
João Carlos
function moveAndScaling (activeState:MovieClip)
{
// move it to the center of the stage.
var myTweenX:Tween = new Tween (activeState, "_xscale", Regular.easeOut,
activeState._xscale, 200, 2, true);
var myTweenY:Tween = new Tween (activeState, "_yscale", Regular.easeOut,
activeState._yscale, 200, 2, true);
//
myTweenX.onMotionChanged = function ()
{
var nX:Number = (Stage.width / 2) - activeState._width / 2;
var nY:Number = (Stage.height / 2) - activeState._height / 2;
activeState._x = nX;
activeState._y = nY;
};
}
João Carlos
----- Original Message -----
From: "Matthew Ganz" <[EMAIL PROTECTED]>
To: "Flashcoders mailing list" <flashcoders@chattyfig.figleaf.com>
Sent: Wednesday, August 02, 2006 5:58 PM
Subject: Re: [Flashcoders] tweening multiple properties
simultaneously --SOLVED
hi jason. thanks -- i like having a separate class for my animations. it
didn't solve my problem but i figured out what was happening and that's
the way i was calculating the displacement (how i'm trying to move the
movie clip to the center of the screen):
*old way*
var nX:Number = (Stage.width/2) - activeState._xmouse;
var nY:Number = (Stage.height/2) - activeState._ymouse;
basically, the source of the problem is that nX and nY are changing as the
movie clip scales up. so the way i solved for it is like this:
*new way*
var nX:Number = (Stage.width/2) - 10*activeState._xmouse;
var nY:Number = (Stage.height/2) - 10*activeState._ymouse;
// zoom into the map
var tween3 = new Tween( activeState, "_xscale", Strong.easeOut,
activeState._xscale, 1000, 2, true );
var tween4 = new Tween( activeState, "_yscale", Strong.easeOut,
activeState._yscale, 1000, 2, true );
// move mouse position to center screen.
var tween1 = new Tween( activeState, "_x", Strong.easeOut,
activeState._x, nX, 2, true );
var tween2 = new Tween( activeState, "_y", Strong.easeOut,
activeState._y, nY, 2, true );
so if i scale up to 1000, i need to multiply the second half of nX and nY
by 10. if i scale up by 4, i'd change that value to 4.
thanks for lending a hand. i appreciate the help.
matt.
----- Original Message -----
From: "Merrill, Jason" <[EMAIL PROTECTED]>
To: "Flashcoders mailing list" <flashcoders@chattyfig.figleaf.com>
Sent: Wednesday, August 02, 2006 11:09 AM
Subject: RE: [Flashcoders] tweening multiple properties simultaneously
Haven't followed the thread close, but maybe wrap it up in a static
class like this - call your custom function which has all the tweens
combined. This is what I do, works for me. Something like this:
//file Animate.as in actionscriptclasspath/com/boa/effects/
import mx.transitions.Tween;
import mx.transitions.easing.*;
class com.boa.effects.Animate{
public static function myFade(clip:MovieClip, time:Number,
xscale:Number, yscale:Number):Array{
var a:Object = new Tween(clip, "_alpha", Regular.easeIn, 0, 100,
time, true);
var b:Object = new Tween(clip, "_xscale", Regular.easeIn, xscale,
100, time, true);
var c:Object = new Tween(clip, "_yscale", Regular.easeIn, yscale,
100, time, true);
//returnArray is just an array of the tweens
//so you can check to see if they are done:
var returnArray:Array = new Array(a,b,c)
return returnArray;
}
}
//.fla and/or other class usage:
import.com.boa.effects.Animate;
Animate.myFade(myClip, .5, 50, 50)
Jason Merrill
Bank of America
Learning & Organization Effectiveness - Technology Solutions
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com