I have an mc that i want to scale smoothly, see attached image that explains it…
heres my code
shrinkMap = function (target_MC:MovieClip, target_WDTH:Number, target_HGHT:Number, target_X:Number) {
target_MC.onEnterFrame = function() {
if (target_MC._width>target_WDTH) {
target_MC._width -= target_MC._width/20;
} else {
target_MC._width = target_WDTH;
}
//
if (target_MC._height>target_HGHT) {
target_MC._height -= target_MC._height/20;
} else {
target_MC._height = target_HGHT;
}
//
if (target_MC._x<target_X) {
target_MC._x += (target_X-target_MC._x)/5;
} else {
target_MC._x = target_X;
}
if (target_MC._width == target_WDTH && target_MC._height == target_HGHT && target_MC._x == target_X) {
delete target_MC.onEnterFrame;
}
//
};
};
It looks really jerky, the different bits finish before each other…is there a way of making each bit (height width and x) scale in proportion of each other so they all finish at the same time? I bet its something to do with what i divide the -= values by (currently arbitrary numbers like 20 or 5)