There are a lot of Flash <-> TUIO libraries, primarily intended to bring the Multitouch TUIO standard to Flash in an API style. Because AS3 is pretty much developed towards the concept of Event Handling (attaching events with functions that are dispatched by the AS3 itself) these libraries work in a similar way to. There are a few possibilities that I’ll show here:
This is a small framework that allows you to do the basic stuff with the TUIO messaging under ActionScript3, it supports:
- TUIO 1.1 (the latest spec)
- Cursors, Objects and Blobs in 2D, 25D & 3D
- Binary data stream via TCP & LocalConnection (because AS3 does not use UDP – this is changing as we speak)
- Callbacks & legacy TouchEvents
- Fully implemented OSC parser (very important, this is the way you extract information from a packed TUIO/OSC message)
Their website describes it quite nicely (see diagram above), although in a very brief testing I had some problems with the linkage in both Flash Builder 4, Flex Builder 3 and even command line MXMLC (Flex Compiler from Open Source Flex SDK) – it may be simple problem that I’m overlooking, I’ll post more as soon as I can get it running here.
The main thing about TouchLib is that it comes packed with AS3 classes to work with TUIO, therefore it offers the same basic funcionalities as above (listening to the TUIO messages, parsing them, etc…), then it comes with something extra: AS3 classes that allow you some funcionality (very typical of Multitouch):
- Automatic rotate, scale and move of the canvas objects (via RotatableScalabe.as)
- and all the stuff of the previous lib…
Make sure that you understand that ToucLib is indeed a CV tracker, intended to multitouch tabletops, it is written in c++ and uses OpenCV.dll but has now been replaced with CCV, what we want here is the Classes of AS3 that comes with TouchLib files from svn, that allow us this multitouch flash behaviour.
You can also check some projects that make use of the TouchLib AS3 classes for Multitouch here (they make interesting demos..).
This fiducial AS3 framework enhances the Touchlib’s AS3 classes with Tuio object interaction functionality.
The adapted Touchlib’s TUIO AS3 classes are included. To make it even clearer: You don’t need any other TUIO AS3 classes then those of fiducialtuioas3 as fiducialtuioas3 supports both multi-touch AND fiducials. It’s complete. You can even use fiducialtuioas3 if you only want to implement multi-touch interaction.
Here’s a demo on a project that uses flash + multitouch + fiducial tracking.
This a small scaled library (with a very similar name to the first one, although they are two different libs) that allows you to receive and parse TUIO messages via As3. This is very simple to use: just include the .swc component in your project or command line include argument. The functionallity is stripped down to minimum, but if this is all you need it might just suit you nicely. Here’s my first demo with this lib.
Testing the Tuio-AS3-lib on a multitouch table from PedroLopes on Vimeo.
Do not mind: the non-calibrated touch points!
I’ve built a “Hello World”-like demo to test the features of TUIO-AS3-lib. It is distributed in either Source or SWC (external component for import). The demo instantiates 3 string objects, they are assigned to an array that is check everytime a touch event arrives in TUIO-AS3-lib listener – this way for each object the colision is detected. I use CCV (tracker) & an ActionScript 3 project (that imports the external SWC of the lib). Some thoughs about TUIO-AS3-lib: interesting project if you just need to listen to the events and implement your interface on top. Simple and plain code, easy to follow. Although it does not implement the same level of features as a full scaled multitouch framework like touchlib that offers scalableObjects, rotatable, and so on…