以编程方式对 Flex 列表组件的翻转指示器进行皮肤处理

发布于 2024-09-10 00:52:53 字数 74 浏览 4 评论 0原文

有谁知道如何将自定义翻转指示器皮肤添加到 Flex 3 列表组件中? 它的 CSS 中没有 rolloveridicatorskin。

Does anybody know how to add custom rolloveridicatorskins to a flex 3 list component?
it doesn't have the rolloveridicatorskin in the css.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

别想她 2024-09-17 00:52:53

如果您只想更改所显示项目的背景和文本颜色,则 ListBase 类定义了以下样式:

  • rollOverColor
    • 当用户将鼠标悬停在渲染器上时渲染器的背景颜色。
    • 默认值为0xEEFEE6
  • textRollOverColor
    • 当用户将鼠标悬停在渲染器上时,渲染器文本的颜色。
    • 默认值为 0x2B333C。

例如:

<mx:List rollOverColor="#FF0000" textRollOverColor="#FFFF00"/>

当您将鼠标移到某个项目上时,将在红色背景上显示黄色文本(!)。

If you just want to change the background and text colors of the items displayed, the ListBase class defines the following styles:

  • rollOverColor
    • The color of the background of a renderer when the user rolls over it.
    • The default value is 0xEEFEE6.
  • textRollOverColor
    • The color of the text of a renderer when the user rolls over a it.
    • The default value is 0x2B333C.

So something like:

<mx:List rollOverColor="#FF0000" textRollOverColor="#FFFF00"/>

Will give you yellow text over red background(!) when you move the mouse over an item.

想念有你 2024-09-17 00:52:53

这是代码。

package 
    {
        import flash.display.Graphics;
        import flash.display.Sprite;
        import flash.filters.DropShadowFilter;

        import mx.controls.List;
        import mx.controls.listClasses.IListItemRenderer;
        import mx.core.ClassFactory;


        public class friendList extends List
        {
            private var dropShadow:DropShadowFilter = new DropShadowFilter(2,117,0x000000,0.4);
            private var filtersArray:Array = new Array(dropShadow); 

           override protected function drawSelectionIndicator(indicator:Sprite, x:Number,
               y:Number, width:Number, height:Number, color:uint,
               itemRenderer:IListItemRenderer):void

           {

              var g:Graphics = Sprite(indicator).graphics;
              g.clear();
              g.beginFill(0x000000, 0.5);
              g.lineStyle(2,0xffffff,0.5);
              g.drawRoundRect(0, 0, width-2, height-2, 6);
              g.endFill();

              indicator.x = x;
              indicator.y = y;   
              indicator.filters = filtersArray;
           }
           override protected function drawHighlightIndicator(
                                    indicator:Sprite, x:Number, y:Number,
                                    width:Number, height:Number, color:uint,
                                    itemRenderer:IListItemRenderer):void
            {
                var g:Graphics = Sprite(indicator).graphics;
                g.clear();
                g.beginFill(0x163e76, 0.5);
                g.lineStyle(2,0xffffff,0.5);
                g.drawRoundRect(0, 0, width-2, height-2, 6);
                g.endFill();

                indicator.x = x;
                indicator.y = y;
                indicator.filters = filtersArray;
            }
       }
    }

Here is the code.

package 
    {
        import flash.display.Graphics;
        import flash.display.Sprite;
        import flash.filters.DropShadowFilter;

        import mx.controls.List;
        import mx.controls.listClasses.IListItemRenderer;
        import mx.core.ClassFactory;


        public class friendList extends List
        {
            private var dropShadow:DropShadowFilter = new DropShadowFilter(2,117,0x000000,0.4);
            private var filtersArray:Array = new Array(dropShadow); 

           override protected function drawSelectionIndicator(indicator:Sprite, x:Number,
               y:Number, width:Number, height:Number, color:uint,
               itemRenderer:IListItemRenderer):void

           {

              var g:Graphics = Sprite(indicator).graphics;
              g.clear();
              g.beginFill(0x000000, 0.5);
              g.lineStyle(2,0xffffff,0.5);
              g.drawRoundRect(0, 0, width-2, height-2, 6);
              g.endFill();

              indicator.x = x;
              indicator.y = y;   
              indicator.filters = filtersArray;
           }
           override protected function drawHighlightIndicator(
                                    indicator:Sprite, x:Number, y:Number,
                                    width:Number, height:Number, color:uint,
                                    itemRenderer:IListItemRenderer):void
            {
                var g:Graphics = Sprite(indicator).graphics;
                g.clear();
                g.beginFill(0x163e76, 0.5);
                g.lineStyle(2,0xffffff,0.5);
                g.drawRoundRect(0, 0, width-2, height-2, 6);
                g.endFill();

                indicator.x = x;
                indicator.y = y;
                indicator.filters = filtersArray;
            }
       }
    }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文