flex增加皮肤

新建mxml外观, <fx:Script>
<![CDATA[
import com.esri.ags.components.ScaleBar;
[Bindable]private var barLength:Number = 0;
[Bindable]private var barHeight:Number = 5;
private var useMetric:Boolean = false; 
override protected function measure():void
{
barLength = useMetric == false ? hostComponent.lengthUS : hostComponent.lengthMetric;
scaleLbl.text = useMetric == false ? hostComponent.textUS : hostComponent.textMetric;
// scaleLbl.x = barLength + 3;
// scaleLbl.y = -(scaleLbl.getExplicitOrMeasuredHeight() / 4);
var metric:String = hostComponent.textMetric;
var us:String = hostComponent.textUS;
if(metric)
{
// if(metric.indexOf("km") > 0)
// metric = metric.slice(0,metric.indexOf("km")) +"千米";
// else if(metric.indexOf("m") > 0)
// metric = metric.slice(0,metric.indexOf("m")) + "米";
}
if(us)
{
if(us.indexOf("mi") > 0)
us = us.slice(0,us.indexOf("mi")) + "千米";
if(us.indexOf("ft") > 0)
us = us.slice(0,us.indexOf("ft")) + "米";
}
hostComponent.textUS = us;
// hostComponent.textMetric =metric;
    scaleLbl.x = barLength + 3;
scaleLbl.y = -(scaleLbl.getExplicitOrMeasuredHeight() / 4);
super.measure();
}




]]>
   </fx:Script>
<fx:Declarations>
<!-- 将非可视元素(例如服务、值对象)放在此处 -->
</fx:Declarations>
<s:Label id="scaleLbl"
fontFamily="Verdana"
fontSize="10"
fontWeight="bold"/>

<s:Rect id="baseRect"
x="0.5" width="{barLength}" height="{barHeight}">
<s:fill>
<s:SolidColor color="#ee0202"/>
</s:fill>
</s:Rect>
<s:Rect x="{baseRect.width/4}" width="{baseRect.width/4}" height="{barHeight}">
<s:fill>
<s:SolidColor color="#009cff"/>
</s:fill>
</s:Rect>
<s:Rect x="{(baseRect.width/4)*3}" width="{baseRect.width/4}" height="{barHeight}">
<s:fill>
<s:SolidColor color="#009cff"/>
</s:fill>
</s:Rect>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值