Reputation: 30188
I want to accomplish the same thing with code that Flash's Align - Align Bottom Edge button does within the IDE. I have a series of move clips of different heights which are all added to the stage dynamically via XML. When they are all added, I want to then align them - does flash provide a method for doing this with code? Or is the only way to do it to detect their heights and adjust them by the height difference?
Upvotes: 0
Views: 687
Reputation: 4810
That functionality is not present in the base ActionScript classes. You only have height, width, x, y, z properties in DisplayObject, Shape, MovieClip, etc.
The Flex framework offers advanced layout functions (horizontal and vertical align in the BasicLayout, as well as top/bottom/right/left positioning constraints). There might be other lightweight frameworks that offer this functionality ("coordy" by someRandomDude comes to mind: http://somerandomdude.com/work/coordy/)
Upvotes: 1
Reputation: 4649
I don't think there's anything like that build in, but it would be pretty easy to do manually using MovieClip's height
property.
// assume you have all your movie clips in an array called myClips
for each(var mc:MovieClip in myClips){
// align all the bottom edges at 100 pixels
mc.y = 100 - mc.height;
}
Upvotes: 1