PDA

View Full Version : [MX] Dynamic Scaling problem



Keith130
August 1st, 2003, 12:01 PM
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



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



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 :



//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);

claudio
August 1st, 2003, 12:47 PM
var i = 20;
ball.swapDepths(i);
function addBall() {
if (i>0) {
i--;
mc = ball.duplicateMovieClip("ball"+i, i);
mc._alpha = (i*10);
mc._xscale = (i*10);
mc._yscale = (i*10);
} else {
clearInterval(myInterval);
}
}
myInterval = setInterval(addBall, 100);

lostinbeta
August 1st, 2003, 01:20 PM
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.

Keith130
August 1st, 2003, 01:22 PM
The mc's still radiate from the starting point of the ball though.

lostinbeta
August 1st, 2003, 01:31 PM
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.

Keith130
August 1st, 2003, 01:45 PM
So how would i set a new x/y?

claudio
August 1st, 2003, 01:47 PM
One way:[AS]mc._x = (i*10);
mc._y = (i*10);[/code]

lostinbeta
August 1st, 2003, 01:52 PM
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.

Keith130
August 1st, 2003, 01:57 PM
I understand what your saying lost, any words of wisdom to overcome the problem?

lostinbeta
August 1st, 2003, 02:01 PM
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.

Keith130
August 1st, 2003, 02:07 PM
Never mind then

kode
August 1st, 2003, 02:50 PM
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. :P

Keith130
August 1st, 2003, 05:47 PM
Thanx a lot Kax!

kode
August 1st, 2003, 06:18 PM
... Lost's idea. ;)

But you're welcome, anyway. :P

lostinbeta
August 1st, 2003, 07:45 PM
Interesting.... good move kax, I honestly don't think I would have been able to figure that out.

Keith130
August 2nd, 2003, 06:25 AM
Thanks both of you then (Happy Kax? :P )