[thelist] Laying out components in Flash

joe stowaway at uklinux.net
Tue May 18 16:01:41 CDT 2004

Marcus Andersson wrote:

> I need a way to position components relative to other components (the 
> way you mostly do in HTML) and also inside parent containers (a la 
> divs) which would result in that if you move the container you also 
> move it's children. I should also say that it must be possible to do 
> this from script (if possible). Is it possible or do I have to do some 
> layout manager stuff (a la layout managers in Java)? All I seem to be 
> able to do is position the components absolute :(
> Any help/pointers is much appreciated.
> Regards,
> /Marcus

hi Marcus

You don't give much (any) detail about how you are instantiating any of 
the components you're using, but when you do so you can access it's 
properties as you would any movie clip.  A component with the instance 
name myComp has properties like:


so if you want to position a new instance of myNextComp relative to 
myComp, you can calculate the latter's position and width and place the 
former accordingly.

you may also find some useful info by looking at the Flash Help on the 
localToGlobal and globalToLocal methods too.



More information about the thelist mailing list