Flex使用AS设置组件width和height的百分比
this.percentWidth = 80;//宽度80%
this.percentHeight = 100;//高度100%
<mx:ColumnChart xmlns:mx="http://www.adobe.com/2006/mxml"
height="100%"
paddingLeft="5"
paddingRight="5"
showDataTips="true"
initialize="setWidth()">
<mx:Script>
<![CDATA[
import com.citi.osm.portal.alert.AlertUtils;
[Bindable]
public var chartWidth:Number;
public function setWidth():void{
this.percentWidth = chartWidth;
}
]]>
</mx:Script>
...
...
</mx:ColumnChart>
<alertchart:AlertChart id="alertChart" chartWidth="100" />
this.percentWidth = 80;//宽度80%
this.percentHeight = 100;//高度100%
<mx:ColumnChart xmlns:mx="http://www.adobe.com/2006/mxml"
height="100%"
paddingLeft="5"
paddingRight="5"
showDataTips="true"
initialize="setWidth()">
<mx:Script>
<![CDATA[
import com.citi.osm.portal.alert.AlertUtils;
[Bindable]
public var chartWidth:Number;
public function setWidth():void{
this.percentWidth = chartWidth;
}
]]>
</mx:Script>
...
...
</mx:ColumnChart>
<alertchart:AlertChart id="alertChart" chartWidth="100" />
本文介绍如何在Flex中使用ActionScript来设置组件的宽度和高度为百分比形式,通过实例展示了如何将图表的宽度设置为父容器的指定百分比。
934

被折叠的 条评论
为什么被折叠?



