11.2. Positioning Form Elements

Problem

You want to programmatically position form elements.

Solution

Set the _x and _y properties of each element.

Discussion

Components are derived from movie clips, so they support the basic movie clip properties and methods, including the _x and _y properties. You can set the _x and _y properties of any component to position it on stage, just as you would with a movie clip:

myComponentInstance._x = 90;
myComponentInstance._y = 180;

See Also

For more complex positioning, see Recipe 11.8 and Recipe 11.22

Get Actionscript Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.