[mtasc] Re: MC sizing question

Steve Webster steve.webster at featurecreep.com
Mon Sep 19 12:49:49 CEST 2005


Hi Andy,

> You've obviously had some experience with actionscript; it keeps  
> tripping me up because its almost but not quite like java. Sigh.

Keep plugging away. There are some quirks which you'll run into every  
now and again, such as this one, but on the whole it's not too bad.

> I wondered if you had any comments on why setting the  _x and _y of  
> a movie clip should be fine but changing its _width and _height  
> should blow it out of the water ?

A MovieClip is effectively an infinitely large canvas with a  
registration point (_x and _y). A MovieClip's _width and _height  
values are equal to the width and height of its content, multiplied  
by the _xscale and _yscale values appropriately. When you set _width  
and _height Flash actually sets the _xscale and _yscale values  
appropriately.

Because you're using trying to resize the clip before using the  
Drawing API to create the content, the initial _width and _height of  
your MovieClip is 0. Flash is flipping out when trying to set _xscale  
and _yscale to what is effectively infinity. You don't actually need  
to set _width and _height at all in your case, since the size of the  
content will constitute the clip's width and height.

Hope this helps!

Steve

PS. You were replying directly to me, so I've CC'd in the list so the  
answer gets archived.

-- 
Steve Webster
Interactive Developer

Featurecreep Ltd.
www.featurecreep.com
14 Orchard Street, Bristol, BS1 5EH
0117 905 5047




More information about the mtasc mailing list