1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
| package
{
import flash.display.GradientType;
import flash.display.Graphics;
import flash.display.Shape;
import flash.display.Sprite;
import flash.geom.Matrix;
import mx.controls.Alert;
import mx.controls.Tree;
import mx.core.FlexShape;
public class TreeAmoi extends Tree
{
public function TreeAmoi()
{
super();
}
override protected function drawRowBackground(s:Sprite, rowIndex:int,
y:Number, height:Number, color:uint, dataIndex:int):void
{
var bg:Shape;
if (rowIndex < s.numChildren)
{
bg = Shape(s.getChildAt(rowIndex));
}
else
{
bg = new FlexShape();
bg.name = "rowBackground";
s.addChild(bg);
}
// Height is usually as tall is the items in the row,
// but not if it would extend below the bottom of listContent.
var height:Number = Math.min(
rowInfo[rowIndex].height,
listContent.height - rowInfo[rowIndex].y);
bg.y = rowInfo[rowIndex].y;
var matrix:Matrix = new Matrix();
var boxWidth:Number = 100;
var boxHeight:Number = 100;
var boxRotation:Number = Math.PI/2;
var tx:Number = 25;
var ty:Number = 0;
matrix.createGradientBox(boxWidth, boxHeight, boxRotation, tx, ty);
var g:Graphics = bg.graphics;
g.clear();
if (color == 16777215)
{
g.beginGradientFill(GradientType.LINEAR, [0xFFFFFF, 0xCCCCCC], [1, 1], [0, 255], matrix); //,null,"pad","rgb",0.75)
}
else
{
g.beginFill(color, getStyle("backgroundAlpha"));
}
g.drawRect(0, 0, listContent.width, height);
g.endFill();
}
}
} |
Partager