Override updateDisplayList, and draw it.
http://pastebin.de/9345
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute"
xmlns:local="*">
<local:VBoxGradientBackground>
<mx:Button label="Sup, Imma Button" />
<mx:Button label="I'm here to showcase vert" />
<mx:Button label="YOu mean like skating?" />
<mx:Button label="Naw man... Flex' VBox" />
</local:VBoxGradientBackground>
</mx:Application>
<?xml version="1.0" encoding="utf-8"?>
<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml"
width="400" height="300">
<mx:Script>
<![CDATA[
import flash.display.Graphics;
override protected function updateDisplayList(unscaledWidth:Number,
unscaledHeight:Number):void
{
super.updateDisplayList(unscaledWidth, unscaledHeight);
var fillType:String = GradientType.LINEAR;
var colors:Array = [0xFF0000, 0x0000FF];
var alphas:Array = [100, 100];
var ratios:Array = [0, 255];
var matrix:Matrix = new Matrix();
matrix.createGradientBox(unscaledWidth, unscaledHeight, 45);
var spreadMethod:String = SpreadMethod.PAD;
graphics.clear();
graphics.beginGradientFill(fillType, colors, alphas, ratios, matrix,
spreadMethod);
graphics.drawRect(2, 2, unscaledWidth - 2, unscaledHeight - 2);
graphics.endFill();
}
]]>
</mx:Script>
</mx:VBox>
----- Original Message -----
From: "Engkee Kwang" <[EMAIL PROTECTED]com>
To: <[EMAIL PROTECTED]ups.com>
Sent: Wednesday, July 19, 2006 8:02 PM
Subject: [flexcoders] gradient background color on VBox
is there a way to set gradient background color on a VBox.
it does not allow me to specify an array of color on backgroundColor
property.
same question wrt. background alpha.
-Engkee
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links