今天学习的时候,要给一个vbox填充渐变的背景颜色,效果如图所示:
但是查属性发现只有backgroundColor 连backgroundImage都没有 我用的是spark主题,sdk4.5.1,<mx:VBox>实现不来效果,几经后找到了解决办法:
就是在mxml文件中的VBox里面直接做一个Group,然后里面做填充颜色,就像些皮肤一样。- -代码如下
- <?xml version="1.0" encoding="utf-8"?>
- <mx:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
- xmlns:s="library://ns.adobe.com/flex/spark"
- xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:logic="com.runqianapp.fastreport.view.logic.*"
- width="100%" height="100%" fontFamily="宋体" >
- <fx:Declarations>
- <!-- 将非可视元素(例如服务、值对象)放在此处 -->
- </fx:Declarations>
- <mx:VBox verticalGap="0" width="100%" height="100%" >
- <mx:HRule strokeWidth="1" strokeColor="#CFD9F5" width="100%"/>
- <mx:HRule strokeWidth="1" strokeColor="#DCE4F7" width="100%"/>
- <mx:HRule strokeWidth="1" strokeColor="#EBEFFB" width="100%"/>
- <mx:HRule strokeWidth="1" strokeColor="#F8F9FE" width="100%"/>
- <s:Group height="100" width="500">
- <s:Rect width="100" height="100">
- <s:fill>
- <s:LinearGradient rotation="90">
- <s:GradientEntry color="#F8F9FE" alpha="1.0"/>
- <s:GradientEntry color="#CFD9F5" alpha="1.0" />
- </s:LinearGradient>
- </s:fill>
- </s:Rect>
- <s:Button label="123"/>
- </s:Group>
- <mx:HRule strokeWidth="1" strokeColor="#D7E3F5" width="100%"/>
- <mx:HRule strokeWidth="1" strokeColor="#D0DBF4" width="100%"/>
- <mx:HRule strokeWidth="1" strokeColor="#C9D5F2" width="100%"/>
- <mx:HRule strokeWidth="1" strokeColor="#C5D1F2" width="100%"/>
- <mx:HRule strokeWidth="1" strokeColor="#A5B8EA" width="100%"/>
- </mx:VBox>
- </mx:Application>
学习ING。。~~