package test {
import mx.core.UIComponent;
import flash.filters.DropShadowFilter;
public class GradientRectangle extends UIComponent {
import flash.display.Graphics;
import flash.geom.Rectangle;
import mx.graphics.GradientEntry;
import mx.graphics.LinearGradient;
protected override function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void {
super.updateDisplayList(unscaledWidth,unscaledHeight);
var w:Number = unscaledWidth;
var h:Number = unscaledHeight;
var backgroundFillColor:Number;
var backgroundFillColor2:Number;
var fill:LinearGradient = new LinearGradient();
var g:Graphics = graphics;
g.clear();
switch (name) {
case "upSkin":
backgroundFillColor = 0x808060;
backgroundFillColor2 = 0xcccc99;
break;
case "overSkin":
backgroundFillColor = 0x808060;
backgroundFillColor2 = 0xcccc99;
break;
case "downSkin":
backgroundFillColor = 0x808060;
backgroundFillColor2 = 0xcccc99;
color: 0xFF0000;
break;
case "disabledSkin":
backgroundFillColor = 0x808060;
backgroundFillColor2 = 0xcccc99;
break;
}
var g1:GradientEntry = new GradientEntry(backgroundFillColor,.10,100);
var g2:GradientEntry = new GradientEntry(backgroundFillColor2,.60,100);
fill.entries = [g1,g2];
fill.angle = 90;
// fill the rectangle
g.moveTo(0,0);
fill.begin(g,new Rectangle(0,0,w,h));
g.lineTo(w,0);
g.lineTo(w,h);
g.lineTo(0,h);
g.lineTo(0,0);
fill.end(g);
// if we're not showing the down skin, show the shadow. Otherwise hide it on the "down state" to look like it's being pressed
if(name != "downSkin") {
filters = [new DropShadowFilter(4, 30,0x000000,.2)];
}
}
}
}
When i compile the above code in Flash 4.6 SDK, i get the below errors. Please suggest me to resolve these:
- 1136: Incorrect number of arguments. Expected 3. – fill.begin(g,new Rectangle(0,0,w,h));
- Access of undefined property color
- Type was not found or was not a compile-time constant: GradientEntry
- Access of undefined property fill
- Access of undefined property g
- Type was not found or was not a compile-time constant: DropShadowFilter
Any help would be great!