<?xml version="1.0" encoding="utf-8"?>
<!--所有组件使用默认值-->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<!--使用容器大小默认值-->
<mx:Panel title="默认的面板容器大小和按钮控件大小" >
<!--使用控件大小默认值-->
<mx:Button id="button1" label="按钮" />
</mx:Panel>
</mx:Application>
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<!--定义面板容器宽度为200像素,高度为0像素-->
<mx:Panel title="绝对值设置控件大小示例" width="200" height="200">
<!--定义按钮宽度为160像素,高度为25像素-->
<mx:Button id="button1" label="按钮" width="160" height ="25"/>
</mx:Panel>
</mx:Application>
application也可以设置w/h
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" width="500" height="400">
<!--定义面板容器宽度为应用容器的50%,高度为应用容器的50%-->
<mx:Panel title="相对值设置控件大小示例" width="50%" height="50%">
<!--定义按钮宽度为面板宽度的50%,高度为面板高度的50%-->
<mx:Button id="button1" label="按钮" width="50%" height ="50%"/>
</mx:Panel>
</mx:Application>