MovieClip._width and _height


_width is the bounds between xMin and xMax.

_width value has a basic unit of twip. The value affected by twip is the same as what we discussed about _x;

_width always is positive. There is no negative _width; If we try to say: _width=-200; Flash just ignores that line of script;

Like _xscale, the _width affects the "Fill" only. If we set _width=0; there is still visible stroke;

Setting _width will change the _xscale correspondingly. 

Heres are several points we need to discuss:

1. Rotation:

What is the _width when the clip rotates an angle ?

If we have a clip of 100x100 pix square, before rotation, the _width is 100 pixels. If we rotate it 45 degree, the _width is 141.4; That is a factor of SQRT(2); Also is the _height; While the _xscale and _yscale remain unchanged as 100;

So, _width and _xscale do not mean the same things in Flash. _width means the xMax-xMin; When the square rotates, the _width is 100*Math.cos(angle);

Here is another confusing condition.
If we have a clip of 100x100 pix Circle, before rotation, the _width is 100 pixels. What will the _width be, if we rotate it 45 degree ? Surprisingly, it is the same as the square clip. Although this clip is a circle, it appears nothing different when we rotate it, but, in fact, it is treated as a Rect.

When we implement "hitTest", it is even confusing. It is the 1.414x1.414 Rectangle that is used for hitTest.

How will setting the _width change the _xscale

Dont expect it simple. When it is without rotation, we just divide the _width with symbol width to get the xscale; But, what will it be when the clip is rotated ?

When a clip of square rotate 45 degrees, the _width is 141.4 and the _height is 141.4; Now what if we try to set _width=100; ?

Well, we might expect that the square will appear as a shape of "diamond" or "narrowed kite"; No, it does not. Simple rotation and scaling are not enough to make a skew effect. The result of changing the _width is a smaller rectangle with 4 corner remaining 90 degree angle. The rotation is still 45 degree while the _xscale and _yscale are adjusted to a new value. It is a rectangle with rotation of 45 degree fitting in a bound of 100x141.4 rect.

2. Setting width in negative _xscale

If we set clip _xscale=-100; The clip is flipped horizontally while the _width is positive 100; If we set _width=-100; This script is ignored. What if we set _width=100 ? The result is that, the _xscale is returned to positive 100 and the clip is flipped back to normal.

It seems that, we can not adjust the _width if we set _xscale to be negative value;

Stroke and _width

3. The width include the width of stroke, so the value is wider than the fill itself. However, the width of stroke is calculated unsatisfactorily and in-accurate. This is discussed in _xscale part.