


export default class ProgressBar extends eui.Component{
    _value=0;
    progressNum;
    private upImage;
    constructor(){
        super()
        this.horizontalCenter=0;
        this.verticalCenter=0;
        this._value=0;
        //文本
        var progressNum = new egret.TextField();
        progressNum.textColor = 0xffffff;
        progressNum.size = 20;
        progressNum.text = "加载中  0%";
        progressNum.x = 0;
        progressNum.y = 65;
        progressNum.textAlign = egret.HorizontalAlign.CENTER;
        progressNum.width = 612;
        this.progressNum=progressNum;
        this.addChild(progressNum)
        var downImage=new eui.Image();
        downImage.source="track_png";
        this.addChild(downImage)
        var upImage=new eui.Image();
        upImage.source="thumb_png";
        this.upImage=upImage;
        this.addChild(upImage)
        var mask=new egret.Shape();
        mask.graphics.clear();
        mask.graphics.beginFill(0xffffff,1);
        mask.graphics.drawRect(0,0,this.value/100*612,60)
        mask.graphics.endFill();
        this.addChild(mask);
        this.upImage.mask=mask;
    }

    get value(){
        return this._value;
    }
    set value(v){
        this._value=v;
        var mask=this.upImage.mask;
        mask.graphics.clear();
        mask.graphics.beginFill(0xffffff,1);
        mask.graphics.drawRect(0,0,this.value/100*612,60)
        mask.graphics.endFill();
    }
}