1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| private function onKeyDown(event : TouchEvent) : void
{
var touch : Touch = event.getTouch(stage);
if (event.getTouch(stage) != null)
{
switch(touch.phase)
{
case TouchPhase.BEGAN :
// test si le clic est dans le bouton démarrer.
if (touch.globalX > 287 && touch.globalY > 336 && touch.globalX < 471 && touch.globalY < 398)
// if(buttonStart.enabled)
this.onKey();
break;
case TouchPhase.ENDED :
// test si le clic est dans le bouton démarrer.
if (touch.globalX > 287 && touch.globalY > 336 && touch.globalX < 471 && touch.globalY < 398)
// if(buttonStart.enabled)
this.onKey();
break;
case TouchPhase.MOVED :
break;
case TouchPhase.HOVER :
break;
default :
break;
}
}
} |