So here are a few setters to start with. Notice that we always call the redrawReflection() method but thanks to the RENDER event we will only draw our reflection once each time the screen is updated.

public function set gradientMode(T:String):void{
if(T == (GradientType.LINEAR || GradientType.RADIAL)){
gradientType = T;
}
else{
gradientType = GradientType.LINEAR;
}
redrawReflection();
}

With this we will be able to set the gradient type we will use. It is LINEAR by default.

public function set alphas(T:Array):void{
_alphas = T;
if(_ratios.length != _alphas.length){
resetRatios(_alphas.length);
}
if(_colors.length != _alphas.length){
resetColors(_alphas.length);
}
redrawReflection();
}

We can use as many colors as we want for our gradient but then the alpha array number of element and ratio array number of element must match perfectly. This setter method makes sure all arrays have the same number of elements. The setter method for the ratios is similar. We won’t need one for the colors since we don’t see them anyway. Now time to get to our drawing method. We will create more setters and getters as we move on but for now let’s get into the drawing matter in the next section.