zorph
03-28-2003, 01:58 AM
here it is:
I really want someone to make my code better. I kind of lost it in the end.
here is the script on my MC:
------------------------
onClipEvent (mouseMove) {
minsize = 70
maxsize = 100
halfwidth = 32
//take the width of the image and divide it by 2 to get the halfwidth.
//This will scale until the edge of image instead of the center point.
startpoint = 100
//How many points away from the edge you want the scale to start.
xdiff = _x - _parent._xmouse;
ydiff = _y - _parent._ymouse;
percent = ((Math.sqrt(xdiff*xdiff+ydiff*ydiff)) +100) /2 ;
if (percent > maxsize) {_xscale = _yscale = minsize}
else {_xscale = _yscale = -percent +(minsize+maxsize);}
if (percent < minsize) {_xscale = _yscale = maxsize}
updateAfterEvent();
}
---------------------------
The above will take any MC, scale it back by 70%, then scale it up to 100% via the mouse position.
Notice I didn't use the "startpoint" variable.
One of the things I want to be able to set the distance at which the scale starts, in pixels, from the the edge of the MC.
I'm new to actionscript, so I would really love for someone to come along and clean this up.... maybe make it cooler.
I really want someone to make my code better. I kind of lost it in the end.
here is the script on my MC:
------------------------
onClipEvent (mouseMove) {
minsize = 70
maxsize = 100
halfwidth = 32
//take the width of the image and divide it by 2 to get the halfwidth.
//This will scale until the edge of image instead of the center point.
startpoint = 100
//How many points away from the edge you want the scale to start.
xdiff = _x - _parent._xmouse;
ydiff = _y - _parent._ymouse;
percent = ((Math.sqrt(xdiff*xdiff+ydiff*ydiff)) +100) /2 ;
if (percent > maxsize) {_xscale = _yscale = minsize}
else {_xscale = _yscale = -percent +(minsize+maxsize);}
if (percent < minsize) {_xscale = _yscale = maxsize}
updateAfterEvent();
}
---------------------------
The above will take any MC, scale it back by 70%, then scale it up to 100% via the mouse position.
Notice I didn't use the "startpoint" variable.
One of the things I want to be able to set the distance at which the scale starts, in pixels, from the the edge of the MC.
I'm new to actionscript, so I would really love for someone to come along and clean this up.... maybe make it cooler.