2 performance related questions

Hi All,

Have 2 questions related to performance imprevement…

  1. Tweening Objects Simuntaneously

I am not quite sure if this is the perfect way currently when we need some movieclips on stage to tween simuntaneously.

Lets say there are 3 movieclips A, B and C. Distance from A to B should ALWAYS be 100px , and B to C should also be ALWAYS 100PX.

So i’m tweening A, 100px leftwards.
TweenMax.to(A, 1, {x:-100});

So in this case to maintain distance the perfect way i can think of is to use the update Listener of TweenMax and in that put
B.x = A.x+100;
C.X = B.x + 100;

I think its better then enterframe Event atleast and also from using 3 seperate tweens , one for each object which might not be so accurate. But i want to know if there is any better way to put the objects in constraints as such, in cases where the calculations are not so simple as +100 etc. May be there is a automated way in Flash to put objects in constraints?

  1. My second question is related to memory space consumed by a variable.
    Suppose i have a function like
    function calculate()
    {
    var a:int = 100;
    }

Now if i call calculate() 20 times then would variable “a” use the same space in memory or everytime it will be allocated different space. Or in other words, after exiting the function would that automatically free the sapce allocated to the variables used inide a function.

Thanks!