How to do flash animation type a scratch card?

3

I'm doing a scratch card in flash and I have 9 boxes with definite color gray what are you doing at the moment and when I click on the boxes it changes color and shows me random numbers of luck, what I want to do and an animation like a real scratch card just like it has on the following http://www.betsoft.com/games/skratcherz site where when I click on the boxes a coin appears and it has the effect of scratching how can I do that?

Flash code

var vars_send:LoadVars = new LoadVars();
var valores_rcv:LoadVars = new LoadVars();
var saldo_rcv:LoadVars = new LoadVars();
var saldo_loaded:LoadVars = new LoadVars();

vars_send.query = "saldo_loaded";
vars_send.sendAndLoad("http://localhost/api.php",saldo_loaded,"POST");

saldo_loaded.onLoad = function(success:Boolean) {
    if (success) {
        saldo.txt_saldo.text = saldo_loaded.saldo;
    } else {
        trace("Erro do conexao");
    }
};

valores_rcv.onLoad = function(success:Boolean) {
    if (success) {
        trace(valores_rcv);
        for (var i:Number = 0; i < 9; i++) {
            _level0["quadrado" + (i + 1)].txt._visible = false;
            _level0["quadrado" + (i + 1)].txt_premio_titulo.text = "Premio:";
            _level0["quadrado" + (i + 1)].txt_premio_titulo._visible = false;
            _level0["quadrado" + (i + 1)].txt_premio._visible = false;
            cor = new Color(_level0["quadrado" + (i + 1)].bg);
            cor.setRGB(0xa2a1a1);
            //
            _level0["quadrado" + (i + 1)].txt.text = valores_rcv["valor" + (i+1)];
            _level0["quadrado" + (i + 1)].txt_premio.text = valores_rcv["premio" + (i+1)];
        }

        if(valores_rcv.saldo >= 0){
            saldo.txt_saldo.text = valores_rcv.saldo;
        }

    } else {
        trace("Erro do conexao");
    }
};

saldo_rcv.onLoad = function(success:Boolean) {
    if (success) {
        trace(saldo_rcv);
        saldo.txt_saldo.text = saldo_rcv.saldo;
    } else {
        trace("Erro do conexao");
    }
};


for (var i:Number = 0; i < 9; i++) {
    _level0["quadrado" + (i + 1)].onRelease = function() {
        cor = new Color(this.bg);
        cor.setRGB(0xFFFF00);
        this.txt._visible = true;
        this.txt_premio._visible = true;
        this.txt_premio_titulo._visible = true;
    };
}
/*function randRange(min:Number, max:Number):Number {
    var randomNum:Number = Math.floor(Math.random() * (max - min + 1)) + min;
    return randomNum;
}*/
iniciar.onRelease = function() {
    vars_send.query = "valores";
    if(valores_rcv.saldo == "1"){
        this.enabled = false;
    }
    vars_send.sendAndLoad("http://localhost/api.php",valores_rcv,"POST");
};
    
asked by anonymous 11.01.2017 / 10:15

0 answers