适用于手机的Flex:是否可以使列表项目变得透明?
Flex(对于移动应用程序)可以使用透明背景渲染列表项吗?
我的应用程序设计包含应该保持可见的背景。
我试着将contentBackgroundAlpha设置为0,但是这不影响项目渲染器。 另外,我尝试交替使用颜色=“[0xffffffff,0xffffffff]”,但它们仍然不透明。
有没有其他解决方法? 这甚至有可能吗?
谢谢。
我认为你正在寻找属性: contentBackgroundAlpha="0"
然后在你的ItemRenderer中:
override protected function drawBackground(unscaledWidth:Number, unscaledHeight:Number):void
{
// transparent background for hit detection
graphics.beginFill(0xFFFFFF, 0);
graphics.lineStyle();
graphics.drawRect(0, 0, unscaledWidth, unscaledHeight);
graphics.endFill();
// turn off opaqueBackground since this renderer has some transparency
opaqueBackground = null;
if (selected || hovered) {
this.setStyle('color', 0x94734D);
}
}
]]>
</fx:Script>
这是我的实现:
1)将此添加到您的自定义IconItemRenderer列表中:
override protected function drawBackground(unscaledWidth:Number, unscaledHeight:Number):void
{
if (itemIndex % 2 == 0)
{
graphics.beginFill(0xFFFFFF, 0);
graphics.lineStyle();
graphics.drawRect(0, 0, unscaledWidth, unscaledHeight);
graphics.endFill();
}
else
{
// transparent background for hit detection
graphics.beginFill(0x004f94, 0.1);
graphics.lineStyle();
graphics.drawRect(0, 0, unscaledWidth, unscaledHeight);
graphics.endFill();
}
opaqueBackground = null;
if (selected)
{
// transparent background for hit detection
graphics.beginFill(0x004f94, 0.2);
graphics.lineStyle();
graphics.drawRect(0, 0, unscaledWidth, unscaledHeight);
graphics.endFill();
}
}
2)将此添加到您的列表属性中:
contentBackgroundAlpha="0.5"
alpha="0.5"
链接地址: http://www.djcxy.com/p/34653.html
上一篇: Flex for mobile: Is it possible to make list items transparents?