Author Topic: Multitouch problems  (Read 1494 times)


  • New Member
  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
Multitouch problems
« on: Tue, Apr 19, 2011 »
Greets all,

I've been using Flixel 2.43 to write some Blackberry PlayBook apps, and wanted to take advantage of it's multitouch capabilities. I wrote some simple test apps (without Flixel, just a bunch of Sprite objects and event listeners), everything was working great.

Unfortunately, as soon as I tried using the same code within a Flixel app, everything broke. Since FlxSprite objects can't use addEventListener, I cant use (for example):
addEventListener(TouchEvent.TOUCH_BEGIN, onTouchBegin);
addEventListener(TouchEvent.TOUCH_MOVE, onTouchMove);
addEventListener(TouchEvent.TOUCH_END, onTouchEnd);

I tried adding the event listeners instead directly to stage or FlxG.stage, but then the Flixel app wouldn't even run on the device, it just hangs at the Volume popup, then dies several seconds later.

Any ideas/suggestions?

« Last Edit: Tue, Apr 19, 2011 by kenc »


  • New Member
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Multitouch problems
« Reply #1 on: Fri, Aug 26, 2011 »
Hey, I was just curious if you found your answer. I have been trying to figure out the same thing. Thanks in advance.



  • Member
  • **
  • Posts: 37
  • Karma: +0/-0
  • War... War never changes....
    • View Profile
    • NetGfx
Re: Multitouch problems
« Reply #2 on: Sat, Aug 27, 2011 »
I was thinking the same thing, but I think the way to go for this is to see how FlixelPowerTools handles mouse events for individual FlxExtendedSprites and try to extend this functionality. I might give this a go, I'll post here if I make any breakthroughs...

Well you could enchance the code of the flixel/system/ to support these:

Code: [Select]
import flash.geom.Point;
import flash.ui.Multitouch;
import flash.ui.MultitouchInputMode;

* Event handler so FlxGame can update the TouchEvent.
* @param FlashEvent A <code>TouchEvent</code> object.
public function handleTouchDown(FlashEvent:TouchEvent):void
if(_current > 0) _current = 1;
else _current = 2;
else if(FlashEvent.type==TouchEvent.TOUCH_END){
if(_current > 0) _current = -1;
else _current = 0;

However I think you could simply use mouseDown and check the coordinates, or check FlixelPowerTools for mouseDrag on FlxSprites.
« Last Edit: Sat, Aug 27, 2011 by Michael71 »