function CreateFonts()
{
    for(var i=0; i<fonts.length; i++)
        fonts[i].ss = new createjs.Sprite(new createjs.SpriteSheet(fonts[i].data));
}

function ClassText(text, _fonts_i)
{
    this.getImg = new createjs.Container();
    this.font = _fonts_i;
    var x = 0;
    var a = 0;
    var img;
    for(var j=0; j<text.length; j++)
    {
        a = fonts[_fonts_i].chars.indexOf(text[j]);
        img = fonts[_fonts_i].ss.clone();
        img.gotoAndStop(a);
        img.x = x;
        x += fonts[_fonts_i].kerning[a];
        this.getImg.addChild(img);
    }
    this.getImg.width = x;
    this.getImg.height = fonts[_fonts_i].line_height;
}

ClassText.prototype.setText = function(val)
{
    var a, b;
    var x = 0;
    if(val.length == this.getImg.getNumChildren())
    {
        for(var i = 0; i < this.getImg.getNumChildren(); i++)
        {
            a = fonts[this.font].chars.indexOf(val[i]);
            b = this.getImg.getChildAt(i);
            b.gotoAndStop(a);
            b.x = x;
            x += fonts[this.font].kerning[a];
        }
        this.getImg.width = x;
    }
    else
    {
        this.getImg.removeAllChildren();
        for(var i = 0; i < val.length; i++)
        {
            a = fonts[this.font].chars.indexOf(val[i]);
            b = fonts[this.font].ss.clone();
            b.gotoAndStop(a);
            b.x = x;
            x += fonts[this.font].kerning[a];
            this.getImg.addChild(b);
        }
        this.getImg.width = x;
    }
};