Tuio as3 library
Our library currently supports:
- TUIO 1.1
- Cursors, Objects and Blobs in 2D, 25D & 3D
- Binary data stream via TCP & LocalConnection
- Callbacks & legacy TouchEvents
- Fully implemented OSC parser
The goal of this library is to deliver a very modular, fast and open as3 Tuio framework that can be easily extended and reused. Another very important aspect is the backwardscompatiblity to make porting of existing Tuio Flash projects as easy as possible.
The diagram below should provide a pretty good overview of the library's key components.

In the following article most of these components will be explained bottom up following the dataflow.
Tracker
Our library supports all Tuio trackers that implement Tuio 1.0 or 1.1 and can deliver their tracking data via TCP and LocalConnection in a raw binary stream.
Bridge
A Bridge can be used to convert UDP Packets into a TCP stream or a LocalConnection.
Connectors
Connectors implement the IOSCConnector interface so other connection types can be easily added. The interface is designed to also allow outgoing streams so the OSC package may also be used in the near future to send OSC commands from Flash to an OSC Server but the currently available IOSCConnectors don't fully implement that part yet.
LocalConnection: This method delivers the best performance in local environment.
TCP: This is currently the only way to directly receive data from a tracker on another computer.
OSC
The library sports a fully featured OSC parser implemented in the OSCManager class that can also be used for other osc based protocols. The OSCManager currently isn't able to send OSC commands but this will be added in the near future when the actual TUIO part of the library is feature complete.
TUIO
The TuioClient implementation is oriented interface wise on the original Tuio Java implementation and uses a callback listener model outside of as3's original eventmodel in order to guarantee the best performance for modules that build upon this api.
Legacy
The legacy package is a collection of classes that make use of the TuioClients Callback model to offer interfaces that are compatible with the interfaces used in earlier Flash/TUIO libraries. e.g. the TouchEvent of the Tuio/XML library.
New Eventmodel
The new eventmodel is currently still worked on but will basically be a combination of the old TouchEvent and the callbacks of the TuioClient.
Callbacks
As already mentioned before this callback model is very similar to the one used in Java and is simply used by implementing the ITuioListener Interface and attaching an instance as a listener to the TuioClient. You can find more on that topic in our Guide section in the article Using the TuioClient.
March 17th, 2010 - 08:44
Where it can be used?
March 17th, 2010 - 19:17
It can be used to create e.g. multitouch or fiducial based applications in flash/as3. See tuio.org or nuigroup.com for more on that topic.
July 1st, 2010 - 03:33
is it possible to determine the tracker? i have 2 cameras working, but need to determine from which camera the tuio data is coming from.
Cheers.
July 1st, 2010 - 14:34
If your trackers support TUIO 1.1 you can get that information by checking yourTuioClient.currentSource
July 3rd, 2010 - 17:52
When do you think the support for sending OSC will be added ?
Thanks
July 3rd, 2010 - 18:51
It already is in the latest svn revision. I’ll write a guide about this when I am done with writing the new guides and updating the current ones.
October 10th, 2010 - 22:45
is there an OSC library that does only that?
I mean, a full osc dedicated one?
October 10th, 2010 - 23:34
I think flosc had som classes for handling osc but that is based on the old brdging via XML. I don’t know of any newer fully OSC dedicated libraries but the osc part of my library should cover most osc needs since it was designed to be an independent part.
November 27th, 2010 - 19:29
Awesome! Just what I was looking for. I tested it and it works perfectly so far. Thanks for your great job.
December 13th, 2010 - 00:12
whats happened with this link?
http://bubblebird.at/tuioflash/how-tos/creating-a-project-using-callbacks/
December 13th, 2010 - 00:34
Ah, I moved that article when I updated the guide section some time ago and seem to have missed to fix this link. Thanks for pointing that out. Should work now.
January 27th, 2011 - 14:55
You should start by very clearly SHOW what this library is about. I was looking for an open source (flash) blog engine, and ended up here. Where I had to scroll browse around for a while to find out what this was all about.
January 27th, 2011 - 20:13
well sorry for the confusion. I somehow stopped at putting the words tuio everywhere, which if you don’t know what tuio is, isn’t very helping I guess.
February 10th, 2011 - 11:41
have one bug
use in flash builder, if creat [object InvalidatingSprite] i can’t received event such as TOUCH_DOWN…
February 10th, 2011 - 21:28
Does it work with a normal Sprite? The dispatching should work with every subclass of DisplayObject. You could try adding your listener directly to the TuioManager which also dispatches the TouchEvents on itself but with the original event target. Via this you can have a look what happens to your TouchEvents.
March 30th, 2011 - 16:06
Hi gimmix, thanks for this very powerful lib.
I’m currently on the svn version and it works well !
I don’t know if it’s the right place to put some suggestions but i’ve got some ideas (not ordered) :
– As mentionned in the main “how to use TuioManager” comments, it would be great to be able to get an array of all the cursors / fiducials / … that are on a same object.
– As the new version is using flash 10 (or upper), it would be nice to convert the Arrays to Vector.. Some arrays relying on the getObjectsUnderPoint() function won’t be changeable, but it would be a great improvement on recursing and recurring functions.
– The TuioDebug is blocking the GestureManager (and maybe TuioManager too) when set to DISCOVER_NONE. I don’t know if it’s the right thing to do, but when the debug is initialized, it could be automatically inserted in the ignoreLists.
– The RotateGesture is fine but the algorythm could be much simplier by using the Math.atan2(dist.x,dist.y)
– I understand the TuioCursors (or TuioContainer) are defined accordingly to the TUIO 1.1 specs, but adding the stageX and stageY variables into the Class would be handy when accessing the TuioContainer. Again, i’m sure you could have many reasons to not implement that.
That’s it for now, thanks again for this lib !
I had wrote my own library when all of this was new and nothing was available but this is really the upper level.
One last thing, in my lib i created some classes that implemented already the drag/scale/rotate functionnalities, it was really useful to just have to create subclasses and define “rotatable = true”, scalable = true, movable = true or tapable = true without having to duplicate codes between different classes.
Keep on,
Ben
March 30th, 2011 - 21:33
thanks for the input! I’ll have a look into it.
June 6th, 2011 - 23:02
2 more small things :
– in the Rotate and ZoomGesture, the touch Points informations are not accessible in the event parameters, therefore the Point corresponding to the center of these touch points is not accessible either. Getting this point would allow the scaling and rotating algorythm to be calculated around this point, so scaling or rotating an object by its corner (for exemple) would make the object’s transform around this point and not around the center. This really makes a difference for the touch & transform feeling and avoid a lot of “loosing the target” behaviour if you see what i mean.
– i added a small implementation to use the mouseEnabled property on parent objects.
If you’re interested by some of my modifications feel free to tell me and i’ll give you the sources.
June 7th, 2011 - 21:01
The first point actually is possible and the rotation and zoom gesture are already implemented in the way you described it in the current svn revision of the library. That the points in the actual event are not accessible is due to the use of as3′s native gesture event.
Modifications and fixes are always welcome
September 21st, 2011 - 11:57
Hi, loving the look of this library.
Is it possible however to track more than one fiducial on the table at once with the same id? It’s important for my current project.
Cheers.
September 21st, 2011 - 21:52
Yes that is possible if you implement your own ITuioListener which will allow you to do whatever you need to with the incoming trackingdata.
See this article as a reference to get started http://bubblebird.at/tuioflash/guides/using-the-tuioclient/
October 29th, 2011 - 18:45
Is in version 0.8 already the support for sending OSC?
Thank you for a great job!
October 29th, 2011 - 20:21
yes sending OSC is supported since v0.7. I should probably integrate that into this page ^^
May 29th, 2012 - 06:09
hi, am developing a Flash application using tuio as multitouch. but it’s having the problem that when i show a pop up Window to render the facebook login, i can’t create another tuio for that window to listen mouse/touch event. Seem only one window can connect tuio at a time.
Anybody have solution for this?
May 29th, 2012 - 18:43
Hi, is the new window a part of the flash app, a new window of the flashapp or a normal browser window? If it is part of the flash application I would suggest faking the window inside the global stage.
Otherwise you could try to find or write a little script that takes the udp/tcp messages from the 3333 port and forwards them to two different ports e.g. 3334 & 3335 where the flash application and the facebook window listen.
If it is a normal browser window you will need to use some kind of tuio2nativetouch bridge which you can find here tuio.org/?software
June 6th, 2012 - 05:22
it’s a new window of AirApp from using this fb APIs : http://code.google.com/p/facebook-actionscript-api/
can u show me how detail of faking is? or is it possible to switch tuio to listen to that window?
August 17th, 2012 - 19:55
Sorry if this has been answered previously, but do you know if Wacom’s OS X drivers provide TUIO data, or whether they can be adapted? I’m interested in the Cintiq, and specifically the new 24HD Touch.
August 17th, 2012 - 20:32
Mh I only know of this project which runs in windows. Maybe you can ask there for some help or port http://nuigroup.com/forums/viewthread/8933/ and http://code.google.com/p/bamboo-tuio/
Maybe you can borrow a citiq somewhere and check if it works with tongseng -> https://github.com/fajran/tongseng/
August 17th, 2012 - 23:03
Thanks for the reply. I have a 24HD Touch on its way. I’ll post my results next week once I’ve run it through its paces.
November 13th, 2012 - 12:02
Can you advice about Flash versions supported by TUIO AS3 library? I have Flash CS3 Professional that supports ActionScript 3.0 (I know it is old version). It seems that flash.net.DatagramSocket is not available (OSCDatagramSocket extends DatagramSocket). Thanks!
November 13th, 2012 - 22:47
Hi Krists. You have to be able to publish Air2.0 if you want to use the UDPConnector or at least Flash 10 for the library to work properly. Afaik that isn’t possible in CS3.
If you are working on Windows I’d suggest that you only create your graphical assets and animations in Flash and export them as .swf files and import those into a FlashDevelop project in which do all the coding and the final export.
November 15th, 2012 - 14:06
Thanks for reply! I figured out I can use LocalConnection connector and udp-flashlc-bridge with my setup.