Native to Touch & Mouse to Touch
Sometimes you might want to convert the native TouchEvents into tuio TouchEvents because there may be no tuio driver or tuiobridge for you touchscreen. This can be done with the Windows7TouchToTuioDispatcher which you simply have to init and Flash's native TouchEvents will be converted into the library ones.
-
import org.tuio.windows7.*;
-
[...]
-
var winTouch:Windows7TouchToTuioDispatcher = new Windows7TouchToTuioDispatcher(stage, false, false);
This will simply dispatch the librarie's TouchEvents on the target specified by the original native TouchEvent.
You can also let the Windows7TouchToTuioDispatcher dispatch the events by using the TuioManager. This might be needed for the GestureManager or if you want to use different target discovery modes.
-
import org.tuio.windows7.*;
-
[...]
-
var tc:TuioClient = new TuioClient(new TCPConnector("127.0.0.1", 3000));
-
var tm:TuioManager = TuioManager.init(stage, tc);
-
var winTouch:Windows7TouchToTuioDispatcher = new Windows7TouchToTuioDispatcher(stage, true, false);
The Windows7TouchToTuioDispatcher can also directly send the TouchEvents to TuioDebug.
-
import org.tuio.windows7.*;
-
[...]
-
var tc:TuioClient = new TuioClient(new TCPConnector("127.0.0.1", 3000));
-
var tm:TuioManager = TuioManager.init(stage, tc);
-
var tDbg:TuioDebug = TuioDebug.init(stage);
-
var winTouch:Windows7TouchToTuioDispatcher = new Windows7TouchToTuioDispatcher(stage);
Note: In the last to snippets I create a new TuioClient which is needed to initialize the TuioManager but the used connector doesn't need to establish a connection in order for the Windows7TouchToTuioDispatcher to work correctly.
What about the Mouse
Converting MouseEvents into TouchEvents works the same way and also gives you the same possibilities of using the TuioManager and the TuioDebug or not.
-
import org.tuio.mouse.*;
-
[...]
-
var tc:TuioClient = new TuioClient(new TCPConnector("127.0.0.1", 3000));
-
var tm:TuioManager = TuioManager.init(stage, tc);
-
var tDbg:TuioDebug = TuioDebug.init(stage);
-
var winTouch:MouseToTouchDispatcher = new MouseToTouchDispatcher(stage);
August 20th, 2010 - 17:32
My application works with TUIO on Tabletop but I’ve just start to use a Multitouch Screen and want to use this specific part of your library in order to use it.
The Transformation Gestures don’t seem to work, actually It only seems to dispatch TouchEvent.TOUCH_DOWN & TouchEvent.TOUCH_UP , I can’t get the TouchEvent.TOUCH_MOVE.
Do you have any explanation about that?
Thank you.
August 21st, 2010 - 11:52
Mh TOUCH_MOVE should work because it is implemented … Maybe you could check if the actual native move TouchEvent is dispatched by adding a listener to the stage.
Additionally the GestureManager currently only works in combination with the TuioManager but that will probably be changed in a future release if needed.
August 23rd, 2010 - 14:57
I find a way for the TOUCH_MOVE : on “Windows7TouchToTuioDispatcher”, the “TuioContainer” created with the function “createTuioContainer” have 0 as value by default for X,Y,Z so the “handleUpdate” function on TUIOManger.as cannot dispatch the TouchEvent.TOUCH_MOVE.
I use the TuioManager, and the GestureManager, now everything work with TUIO table, and the Touch_Down/Touch_Up/Touch_Move work. But I don’t understand what to do in order to use GestureManager with Windows7TouchToTuioDispatcher.
Do you have some examples?
I’m kind of noob
August 23rd, 2010 - 16:49
Mh it should just work if you use the GestureManager instead of the TuioManager. Let me know if that does the trick and thanks for the tip on how to fix the TOUCH_MOVE.