To size a rectangle I use the following actionscript:
function sizeRectangle() {
rectangle.onEnterFrame = function() {
with (rectangle) {
w = (Stage.width);
speed = 5;
_width += (w-_width)/speed;
if (_width>(w-1)) {
delete rectangle.onEnterFrame;
_width = w;
}
}
};
}
It all works fine.
When a certain button is pressed it needs to size itself to zero again.
This is easy to do by altering “w=(Stage.width);” to “w=0;”.
What happends is that it will shrink from right to left.
But how do i code this when I want the rectangle to shrink from left to right?