TOUCH_END events not being dispatched anymore in this case
Background:
Recently, we have published an iOS game made by AIR, some players report to us their virtual joystick some times is in a mess.
So i deep into the touch events, found that some times the TouchEvent.TOUCH_END dies(TOUCH_TAP dies either)!
After days research, i found this is a Bug for AIR internally. I'v wrote a sample code to reproduce the issue:
(AIR SDK 20.0, iOS 8.4, iPhone 6 Plus, iPhone6 tested)
package{
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageQuality;
import flash.display.StageScaleMode;
import flash.events.Event;
import flash.events.TouchEvent;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.ui.Multitouch;
import flash.ui.MultitouchInputMode;
[SWF(backgroundColor="#003300")]
public class TouchEndFiring extends Sprite{
private var debugText:TextField;
public function TouchEndFiring(){
super();
stage.quality = StageQuality.HIGH;
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
stage.frameRate = 30;
Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;
stage.addEventListener(Event.RESIZE, __resized);
stage.addEventListener(TouchEvent.TOUCH_BEGIN, __touchBegin);
stage.addEventListener(TouchEvent.TOUCH_MOVE, __touchMove);
stage.addEventListener(TouchEvent.TOUCH_END, __touchEnd);
stage.addEventListener(TouchEvent.TOUCH_TAP, __touchTap);
debugText = new TextField();
debugText.defaultTextFormat = new TextFormat(null, null, 0xFFFFFF);
debugText.mouseEnabled = false;
debugText.selectable = false;
debugText.mouseWheelEnabled = false;
debugText.width = stage.stageWidth;
debugText.height = stage.stageHeight;
debugText.text = "Madly continue press/swap both left and right down corner will make touch end event not firing anymore";
addChild(debugText);
}
private function __touchBegin(e:TouchEvent):void{
print(e.touchPointID + "-" + e.type);
}
private function __touchMove(e:TouchEvent):void{
print(e.touchPointID + "-" + e.type);
}
private function __touchEnd(e:TouchEvent):void{
print(e.touchPointID + "-" + e.type);
}
private function __touchTap(e:TouchEvent):void{
print(e.touchPointID + "-" + e.type);
}
private function __resized(e:Event):void{
debugText.width = stage.stageWidth;
debugText.height = stage.stageHeight;
}
private function print(msg:String):void{
debugText.appendText(msg+"\n");
debugText.scrollV = debugText.maxScrollV;
if(debugText.length > 2000){
debugText.text = "";
}
}
}
}
with application sets:
<aspectRatio>landscape</aspectRatio>
<renderMode>direct</renderMode>
<autoOrients>true</autoOrients>
<fullScreen>true</fullScreen>
<visible>true</visible>
and
<iPhone>
<InfoAdditions><![CDATA[
<key>UIDeviceFamily</key>
<array>
<string>1</string>
<string>2</string>
</array>
<key>UIPrerenderedIcon</key>
<true/>
]]></InfoAdditions>
<requestedDisplayResolution>high</requestedDisplayResolution>
</iPhone>
For the beginning, the events are fired correctly, but if you touch/swap rapidly both on left and right down corner(some times press inside screen and drag outside) just like you are playing a landscape orients ACT game, soon later, you can find the BEGIN and MOVE events fires but with no END either TAP events, after that, the TOUCH_END event will no longer fires anymore -- except only this way :
1. First touch one finger on the screen and do not release -- keep pressing
2. Touch another finger and then release, this finger will have TOUCH_END event fired, but the first finger will not when you release it.
From now on, if you just make one touch a time, you will just get TOUCH_BEGIN/TOUCH_MOVE, no more TOUCH_END neither TOUCH_TAP. This make the application interaction broken!
Attention: I can not say a specified operation to reproduce the bug, but i always make it out with rapid click and drag on lower-left and lower_right corner for a moment with two fingers at the same time.

