Chinaunix首页 | 论坛 | 博客
  • 博客访问: 52610
  • 博文数量: 22
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 197
  • 用 户 组: 普通用户
  • 注册时间: 2013-12-16 17:30
文章分类
文章存档

2016年(1)

2014年(14)

2013年(7)

我的朋友

分类: 信息化

2013-12-20 16:26:51

mx|Alert{

        borderSkin:ClassReference("skins.AlertSkin");

        buttonStyleName: "alertButton";

}

.alertButton { 

        upSkin: Embed(source="flexlib/assets/assets.swf",symbol="Button_upskin");

        downSkin: Embed(source="flexlib/assets/assets.swf",symbol="Button_downskin");

        overSkin: Embed(source="flexlib/assets/assets.swf",symbol="Button_overskin");

        disabledSkin: Embed(source="flexlib/assets/assets.swf",symbol="Button_disabledskin");

上面的这段CSS样式。一共设置的两个部分,一个是皮肤,一个是按钮。先说按钮,下面这个是标识按钮的样式。我们是通过载入SWF中的库文件达到获取按钮的各状态皮肤。

 

                         xmlns:fx="" 

                         xmlns:s="library://ns.adobe.com/flex/spark" 

                         implements="mx.core.IRectangularBorder"> 

        

         

                

                        import mx.core.EdgeMetrics; 

                        import mx.core.IUIComponent; 

                        

 

                        static private const exclusions:Array = ["background"]; 

                        override public function get colorizeExclusions():Array { 

                                return exclusions; 

                        } 

                        

 

                        static private const contentFill:Array = []; 

                        override public function get contentItems():Array { 

                                return contentFill 

                        }; 

                        

                        private var _metrics:EdgeMetrics = new EdgeMetrics(1, 32, 1, 1); 

                        public function get borderMetrics():EdgeMetrics { 

                                var hasPanelParent:Boolean = isPanel(parent); 

                                var controlBar:IUIComponent = hasPanelParent ? Object(parent).mx_internal::_controlBar : null; 

                                if (controlBar && controlBar.includeInLayout) { 

                                        _metrics.bottom = controlBar.getExplicitOrMeasuredHeight() + 1; 

                                } else { 

                                        _metrics.bottom = 1; 

                                } 

                                return _metrics; 

                        } 

                        

                        public function get backgroundImageBounds():Rectangle { 

                                return null; 

                        } 

                        

                        public function set backgroundImageBounds(value:Rectangle):void { 

                        } 

                        

                        public function get hasBackgroundImage():Boolean { 

                                return false; 

                        } 

                        

                        public function layoutBackgroundImage():void { 

                        } 

                        

                        override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void { 

                                var em:EdgeMetrics = borderMetrics; 

                                if (em.bottom > 1) { 

                                        cbbg.height = em.bottom - 1; 

                                        cbdiv.bottom = cbbg.height; 

                                        cbbg.visible = cbdiv.visible = true; 

                                } else { 

                                        cbbg.visible = cbdiv.visible = false; 

                                } 

                                super.updateDisplayList(unscaledWidth, unscaledHeight); 

                        } 

                        

                        private static var panels:Object = {}; 

                        

                        private static function isPanel(parent:Object):Boolean { 

                                var s:String = getQualifiedClassName(parent); 

                                if (panels[s] == 1) { 

                                        return true; 

                                } 

                                if (panels[s] == 0) { 

                                        return false; 

                                } 

                                if (s == "mx.containers::Panel") { 

                                        panels[s] == 1; 

                                        return true; 

                                } 

                                var x:XML = describeType(parent); 

                                var xmllist:XMLList = x.extendsClass.(@type == "mx.containers::Panel"); 

                                if (xmllist.length() == 0) { 

                                        panels[s] = 0; 

                                        return false; 

                                } 

                                panels[s] = 1; 

                                return true; 

                        } 

                ]]> 

         

        

         

         

                 

                         

                 

                 

                         

                 

         

        

         

         

                 

                         

                 

         

        

         

         

                 

                        

                 

         

        

         

         

                 

                         

                                 

                                 

                         

                 

         

        

         

         

                 

                         

                                 

                                 

                         

                 

         

         

                 

                         

                 

         

        

         

         

                 

                         

                 

         

        

         

         

                 

                         

                 

         

        

这段文字是Alert的皮肤设置,这个是应用在Flash Builder4以上版本的。

阅读(330) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~