Create a Constraint-based Layout
主要是设置好各元素与边框之间的距离。也就是right,left,top,bottom。
Maintain the component's position and size 【None】
Move the component horizontally【Right】
Move the component vertically【Bottom】
Move the component both horizontally and vertically【Right + Bottom】
Resize the component horizontally【Left + Right】
Resize the component vertically【Top + Bottom】
Resize the component both horizontally and vertically【Left + Right + Top + Bottom】
Center the component horizontally【Horizontal center】
Center the component vertically【Vertical center】
MXML代码如下:
程序代码
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Label x="20" y="60" text="E-mail:"/>
<mx:TextInput y="60" left="90" right="60"/>
<mx:Label x="20" y="90" text="Comment:"/>
<mx:TextArea left="90" right="60" top="90" bottom="190"/>
<mx:Button label="send" right="60" bottom="150"/>
</mx:Application>
文章来自: 闪客居(www.flashas.net) 详文参考:http://www.flashas.net/html/Flex/20070929/2178.html