有没有办法填充s:Rect有3-4种不同的颜色和旋转45度?类似的东西:
<s:fill>
<s:SolidColor color="#ff0000" />
<s:SolidColor color="#00ff00" />
<s:SolidColor color="#ffff00" />
</s:fill>
答案 0 :(得分:1)
使用LinearGradient作为fill
属性,如下所示:
<s:Rect left="0" right="0" top="0" bottom="0">
<s:fill>
<s:LinearGradient rotation="45">
<s:GradientEntry color="#ff0000" />
<s:GradientEntry color="#00ff00" />
<s:GradientEntry color="#ffff00" />
</s:LinearGradient>
</s:fill>
</s:Rect>
答案 1 :(得分:0)
protected function box1_mouseOverHandler(event:MouseEvent):void
{
if(event.currentTarget!=null)
{
if(event.type == MouseEvent.MOUSE_OVER)
{
var fill:LinearGradient = new LinearGradient();
var g1:GradientEntry = new GradientEntry(0xE7E7E7);
var g2:GradientEntry = new GradientEntry(0xFDFDFD);
fill.entries = [g1,g2];
fill.rotation = 45;
event.currentTarget.backgroundFill = fill;
Mouse.cursor = MouseCursor.BUTTON;
}
else
{
var fill1:LinearGradient = new LinearGradient();
var g3:GradientEntry = new GradientEntry(0xFDFDFD);
var g4:GradientEntry = new GradientEntry(0xE7E7E7);
fill1.entries = [g3,g4];
fill1.rotation = 45;
event.currentTarget.backgroundFill = fill1;
Mouse.cursor = MouseCursor.AUTO;
}
}
}