The standard is to check if the touch object returned from getTouch()
is null
before checking for the phase
property.
var touch:Touch = e.getTouch( stage );
if ( touch ) {
if( touch.phase == TouchPhase.ENDED ) {
resetBall();
}
}
From the starling wiki:
private function onTouch(event:TouchEvent):void
{
var touch:Touch = event.getTouch(this, TouchPhase.BEGAN);
if (touch)
{
var localPos:Point = touch.getLocation(this);
trace("Touched object at position: " + localPos);
}
}