package components.Tools
{
    import flash.display.Sprite;

    public class BannerTriangle extends Sprite{
        public var fillColor:uint;
        private var fillAlpha:Number;
        public var lineColor:uint;
        public var lineWidth:Number;
        private var lineAlpha:Number;
        private var XPos:Number;
        private var YPos:Number;
        
        public function BannerTriangle(fCol:uint,w:Number,h:Number,fAlpha:Number,lCol:uint,lWidth:Number,lAlpha:Number){
            paint(fCol,fAlpha,lCol,lWidth,lAlpha);
        }
        private function paint(fCol:uint,fAlpha:Number,lCol:uint,lWidth:int,lAlpha:Number,xPos:Number=1,yPos:Number=1):void{
            this.graphics.lineStyle(lWidth, lCol, lAlpha);
            this.graphics.moveTo(xPos/2, 0)
            this.graphics.beginFill(fCol, fAlpha);
            this.graphics.lineTo(xPos, yPos);
            this.graphics.lineTo(0, yPos);
            this.graphics.lineTo(xPos/2, 0);
            this.graphics.endFill();
            //armazenando os parametros exatos caso seja preciso redesenhar depois
            fillColor = fCol;
            fillAlpha = fAlpha;
            lineColor = lCol;
            lineWidth = lWidth;
            lineAlpha = lAlpha;
            XPos = xPos;
            YPos = yPos
        }
        public function changeFill(col:uint):void{
            this.graphics.clear();
            paint(col,fillAlpha,lineColor,lineWidth,lineAlpha,XPos,YPos);
        }
        public function changeLine(col:uint,thick:Number):void{
            this.graphics.clear();
            paint(fillColor,fillAlpha,col,thick,lineAlpha,XPos,YPos);
        }
        public function redraw(fCol:uint,fAlpha:Number,lCol:uint,lWidth:Number,lAlpha:Number):void{
            this.graphics.clear();
            paint(fCol,fAlpha,lCol,lWidth,lAlpha,mouseX,mouseY);
        }
    }
}