Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/apache-flex/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache flex Flex itemrenderer禁用滚动,但保持交替颜色_Apache Flex_Effects_Itemrenderer_Rollover - Fatal编程技术网

Apache flex Flex itemrenderer禁用滚动,但保持交替颜色

Apache flex Flex itemrenderer禁用滚动,但保持交替颜色,apache-flex,effects,itemrenderer,rollover,Apache Flex,Effects,Itemrenderer,Rollover,有没有一种方法可以在不丢失交替背景色的情况下自定义项目渲染器的滚动和选定颜色 当我将AutoDruckGround标志设置为false时,翻滚效果将停止,但由于某些原因,也不会绘制交替背景 我想创建一个渲染器,它在悬停状态下绘制白色边框,在选定状态下绘制黄色边框,而不是默认的滚动颜色。 我还想保留我在列表中设置的交替背景色 有什么建议吗? <s:states> <s:State name="normal" /> <s:State name="hov

有没有一种方法可以在不丢失交替背景色的情况下自定义项目渲染器的滚动和选定颜色

当我将AutoDruckGround标志设置为false时,翻滚效果将停止,但由于某些原因,也不会绘制交替背景

我想创建一个渲染器,它在悬停状态下绘制白色边框,在选定状态下绘制黄色边框,而不是默认的滚动颜色。 我还想保留我在列表中设置的交替背景色

有什么建议吗?


<s:states>
    <s:State name="normal"  />
    <s:State name="hovered"  />
    <s:State name="selected"  />
</s:states>

<s:BorderContainer backgroundColor.selected="0xA9C6EE" backgroundColor.normal="0xffffff" backgroundColor.hovered="0xCEDBEE" height="50" width="233">        

</s:BorderContainer>

如果我没有误解您的问题,我想这就是您需要的:)

您可以使用ItemRenderer类的“itemIndex”属性来绘制背景。例如:

override protected function updateDisplayList(unscaledWidth:Number,
                                              unscaledHeight:Number):void 
{
    backgroundFill.color = itemIndex % 2 ? 0xff0000 : 0x00ff00;
    super.updateDisplayList(unscaledWidth, unscaledHeight);
}
将在红色和绿色行之间交替显示背景图形,如下所示:

<s:Rect id="background" left="0" right="0" top="0" bottom="0">
    <s:fill>
        <s:SolidColor id="backgroundFill" />
    </s:fill>
</s:Rect>


使用这种技术,你显然也可以做更复杂的事情,比如渐变、阿尔法效果等等。

这正是我真正需要的。但问题是,我必须将AutoDruckGround设置为false,否则也会触发默认的翻转效果。当我将此标志设置为false时,我在列表上设置的AlternatingRowColor不再起作用。我使用了RIAstar的答案,使用getStyle(“alternatingItemColors”)来设置列表上设置的颜色数组,您可以根据需要设置样式。例如
“List.blueTheme{selectionColor:#7FACF6;}
[link]您可以看到如何设置样式的详细示例。谢谢,这就是我所缺少的。我将您的解决方案与getStyle(“AlternatingItemColor”)结合使用要在列表中设置颜色,这样我就不必将它们存储在渲染器中,有一个名为“useRollOver”的属性。将其设置为false,不要使用AutoDruckGround=false,因为这会导致问题。useRollOver仅适用于MX组件。AutoDruckGround仅适用于列表控件,而不适用于数据网格。