How to make flash animation like a scratch card?

Asked

Viewed 268 times

3

I’m doing a flash slushee and I’ve got nine boxes of gray color that you’re doing right now and when I click on the boxes it changes color and shows me the random numbers of luck, what I want to do and an animation like a real scratch card just like it has on the following site http://www.betsoft.com/games/skratcherz where when I click on the boxes a coin appears and does the effect of scraping how I can do this ?

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");
};
  • I already have the design of the boxes and it already works but it only works by clicking on top only changes color and shows the data does not make the effect as I want it presented on the site above and what I want to do

  • Sorry! Now I went to see

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.