0

我正在尝试使 BitmapImage 标记与其容器一样宽,同时缩放位图。我使用这段代码实现了它,我认为你会发现它很明显:

<s:BitmapImage id='image' width='100%' source='assets/eyes.jpg' scaleMode="letterbox"/>

我遇到的问题是,在容器宽度和图像大小的某些组合下,位图根本不显示。我减少了这个问题,发现如果我向上(或向下)取整(或向下) BitmapImage 的高度(例如,使用计时器),它会完美显示。所以我假设问题与高度是一些奇怪的十进制数有关(尽管它确实适用于一些非整数高度)。

有人发现同样的问题吗?如果您需要,我有代码可以重现它。

4

2 回答 2

0
  <s:controlBarContent>
    <mx:Form id="fid">
        <mx:FormItem id="fiid" label="cornerRadius:">
            <s:HSlider id="sl"
                       minimum="0"
                       maximum="{bmpImg.height/2}" />
        </mx:FormItem>
    </mx:Form>
</s:controlBarContent>
<s:Group id="grp" width="50%" height="50%" horizontalCenter="0" verticalCenter="0" color="RED" >




<s:BitmapImage id="bmpImg" depth="100" width="{grp.width}" height="{grp.height}"
               source="@Embed('assets/image1.jpg')"
               horizontalCenter="0" verticalCenter="0">
    <s:mask>
        <s:BorderContainer id="bmpMask"
                           cornerRadius="{sl.value}"
                           width="{bmpImg.width}" height="{bmpImg.height}" />
    </s:mask>
</s:BitmapImage>
</s:Group>
于 2013-01-29T06:25:29.130 回答
0
 <s:Group id="grp" width="50%" height="50%" horizontalCenter="0" verticalCenter="0" color="RED" >




<s:BitmapImage id="bmpImg" depth="100" width="{grp.width - 20}" height="{grp.height - 30}"
               source="@Embed('assets/image1.jpg')"
               horizontalCenter="0" verticalCenter="0">
    <s:mask>
        <s:BorderContainer id="bmpMask"
                           cornerRadius="{sl.value}"
                           width="{bmpImg.width}" height="{bmpImg.height}" />
    </s:mask>
</s:BitmapImage>
</s:Group>
于 2013-01-29T06:20:44.060 回答