function ClassFlyPets()
{
    this.getImg = new createjs.Container();
    this.img = [];
}

ClassFlyPets.prototype.Drw = function()
{
    for(var i = 0; i < this.img.length; i++)
    {
        this.img[i].x += this.img[i].speedX;
        this.img[i].y += this.img[i].speedY;
        if(this.img[i].y < game.all_job.job.getImg.y+4)
        {
            game.all_job.job.AddN(this.img[i].name, this.img[i].value);
            this.getImg.removeChild(this.img[i]);
            this.img.splice(i, 1);
        }
    }
};

ClassFlyPets.prototype.Create = function()
{
    for(var i = 0; i < this.img.length; i++)
    {
        this.getImg.removeChild(this.img[i]);
        this.img.splice(i, 1);
        i--;
    }
};

ClassFlyPets.prototype.StartFly = function()
{
    var a = 0;
    for(var i=0; i<game.grid.height; i++)
        for(var j=0; j<game.grid.width; j++)
            if(game.grid.destroy[i][j] != 0)
            {
                game.fly.Add(game.grid.mass[i][j].ID, game.grid.mass[i][j].val, game.grid.mass[i][j].multi, i, j, a);
                a+=3;
            }
    //game.fly.Add(this.elements[i][j].ID, this.elements[i][j].value, this.elements[i][j].multi, i, j, a);
};

ClassFlyPets.prototype.Add = function(id, value, a, y, x, z)
{
    for(var i = 0 ; i < game.all_job.job.job_l.length; i++)
        if(id == 0)
        {
            if(game.all_job.job.job_l[i].current < game.all_job.job.job_l[i].count && game.all_job.job.job_l[i].value == value && game.all_job.job.job_l[i].ID == id)
            {
                console.log("id 0==" + id);
                game.all_job.job.AddLg(i, a);
                this.img.push(ss_data.clone());
                this.img[this.img.length-1].gotoAndStop(game.color[value]);
                this.img[this.img.length-1].name = i;
                this.img[this.img.length-1].value = a;
                this.img[this.img.length-1].scaleX = this.img[this.img.length-1].scaleY = 0.6;
                this.img[this.img.length-1].x = game.grid.getImg.x + x*(40*devise_size);
                this.img[this.img.length-1].y = game.grid.getImg.y + y*(40*devise_size);
                this.img[this.img.length-1].speedX = (game.all_job.job.getImg.x - game.all_job.job.getImg.regX + (51*devise_size)*i - this.img[this.img.length-1].x)/(30+z);
                this.img[this.img.length-1].speedY = (game.all_job.job.getImg.y + (2*devise_size) - this.img[this.img.length-1].y)/(30+z);
                this.getImg.addChild(this.img[this.img.length-1]);
            }
        }
        else
        {
            if(id == 3 || id == 4)
            {
                if(game.all_job.job.job_l[i].current < game.all_job.job.job_l[i].count && game.all_job.job.job_l[i].ID == id)
                {
                    console.log("id 3==" + id);
                    game.all_job.job.AddLg(i, a);
                    this.img.push(ss_data.clone());
                    if(game.all_job.job.job_l[i].ID == 3)
                        this.img[this.img.length-1].gotoAndStop("pumpkin2");
                    else
                        this.img[this.img.length-1].gotoAndStop("watermelon2");
                    this.img[this.img.length-1].name = i;
                    this.img[this.img.length-1].value = a;
                    this.img[this.img.length-1].scaleX = this.img[this.img.length-1].scaleY = 0.6;
                    this.img[this.img.length-1].x = game.grid.getImg.x + x*(40*devise_size);
                    this.img[this.img.length-1].y = game.grid.getImg.y + y*(40*devise_size);
                    this.img[this.img.length-1].speedX = (game.all_job.job.getImg.x - game.all_job.job.getImg.regX + (51*devise_size)*i - this.img[this.img.length-1].x)/(30+z);
                    this.img[this.img.length-1].speedY = (game.all_job.job.getImg.y + (2*devise_size) - this.img[this.img.length-1].y)/(30+z);
                    this.getImg.addChild(this.img[this.img.length-1]);
                }
            }
        }
};