MovieClip Scale

Ok, I mentioned "multiple properties" on the previous page, so we should experiment with another property: scale. Actually, we'll be working with two properties: _xscale (the horizontal "stretch") and _yscale (the vertical "stretch").

The default value for _xscale and _yscale is 100(for 100% of it's normal size) So, if you want to make a movieClip half the size, you set:

movieClip._xscale = 50;
movieCip._yscale=50;

You can "stretch" the clip by choosing different values for _xscale and _yscale, but I want to keep the same ratio for my stars, so I'm going to set both properties equal to a single random number between 20 (not too small) but no greater than 100. Start by generating that number:

  1. Click Statements > Variables > var
  2. Type myScale = random(80)+20 in the Variables box (this will generate a number between 20 and 99)
  3. Select Number from the Data Type drop-down-list

Now use set variable to set both the _xscale and _yscale of newStar equal to myScale:

Behold: