[MX] Dynamic Scaling problem

The following actionscript is some that I got from lostinbeta from an alpha fade question I had, that works fine but I now would like to have the movieclips get smaller at the same time as fading. So I put in some code that went like this

[AS]

//set the transform
mc._xscale = (i10);
mc._yscale = (i
10);

[/AS]

That worked but the duplicated MC’s are all pointing to the starting point of the main “Ball” MC. I dont know how to fix it, as usall. Here is the bulk of the code :

[AS]

//define variable to hold how man clips there should be
var i = 20;
//put original clip on top of all duplicated clips
ball.swapDepths(i);
//create function to add multiple balls
function addBall() {
//if variable i is greater than 0
if (i>0) {
//decrement it by 1
i–;
//duplicate the ball clip
mc = ball.duplicateMovieClip(“ball”+i, i);
//set the alpha
mc._alpha = (i*10);

//transform script here ?
			
			
    } else {
            //else if variable i isn't greater than 0
            //clear the interval (stop running this function)
            clearInterval(myInterval);
    }

}
//set the interval and call the addBall function every 15 milliseconds
myInterval = setInterval(addBall, 15);

[/AS]

[AS]var i = 20;
ball.swapDepths(i);
function addBall() {
if (i>0) {
i–;
mc = ball.duplicateMovieClip(“ball”+i, i);
mc._alpha = (i10);
mc._xscale = (i
10);
mc._yscale = (i*10);
} else {
clearInterval(myInterval);
}
}
myInterval = setInterval(addBall, 100);[/AS]

The problem with resizing this is simple… your tweens is contained in a movie clip symbol. When you scale down the movie clip symbol, it isn’t able to keep up with the original clip because the entire tween area is shrunk down with it.

I am guessing you would have to make the ball shape inside the ball movie clip symbol another movie clip symbol and then target that for the new settings, but im not sure. I don’t have time work on that right now. Sorry.

The mc’s still radiate from the starting point of the ball though.

Yeah, because you are duplicating the original clip, and when you do that, since you don’t set a new x and y position for the clip it generates at the original clips position.

So how would i set a new x/y?

One way:[AS]mc._x = (i10);
mc._y = (i
10);

Even if you were to set a new xy position it still wouldn’t follow the right path. You are scaling the whole clip, so the whole path is shrinking as well.

Check my attachment to see it manually.

I understand what your saying lost, any words of wisdom to overcome the problem?

I have no clue, I tried converting the ball graphic inside the ball clip to a movieclip symbol, and it worked just great, but when I tried to edit the _xscale and _yscale size of that clip, the tween became obsolete and it wouldn’t work anymore.

I don’t know how to fix it, sorry.

Never mind then

Originally posted by lostinbeta
**I have no clue, I tried converting the ball graphic inside the ball clip to a movieclip symbol, and it worked just great, but when I tried to edit the _xscale and _yscale size of that clip, the tween became obsolete and it wouldn’t work anymore.

I don’t know how to fix it, sorry.**

You were on the right track, all you had to do is convert it to MovieClip one more time. :stuck_out_tongue:

Thanx a lot Kax!

… Lost’s idea. :wink:

But you’re welcome, anyway. :stuck_out_tongue:

Interesting… good move kax, I honestly don’t think I would have been able to figure that out.

Thanks both of you then (Happy Kax? :stuck_out_tongue: )