vendredi 17 février 2017

Stop and Resume issue with stage.frameRate

I use stage.frameRate for stop and resume the game.The game menu down on stage to when click the pause button.But when I click stop button it not work until when I moving the mouse.

stopa.addEventListener(MouseEvent.CLICK, onClick);
function onClick(e:MouseEvent):void
{

fa.y+=asagi;
ban.y+=banasagi;
playa.y+=asagi;

if (fa.y>=fa.height/0.0) {
    asagi*=-2;
}   

if (ban.y>=ban.height/0.0) {
    banasagi*=-2;
}   

if (playa.y>=playa.height/0.0) {
    asagi*=-2;
}   
stage.frameRate = 0.01;
}
 
//Resume Button
playa.addEventListener(MouseEvent.CLICK, onaClick);
function onaClick(e:MouseEvent):void
{
timercheck.stop();

  fa.y+=yukari;
  ban.y+=banyukari;
  playa.y+=yukari;

if (fa.y>=fa.height/0.0) {
    yukari*=-2;
}

    if (ban.y>=ban.height/0.0) {
    banyukari*=-2;
}

        if (playa.y>=playa.height/0.0) {
    yukari*=-2;
}
stage.frameRate = 24;
}

Aucun commentaire:

Enregistrer un commentaire