Touchlib’s TUIO Actionscript 3 Classes Enhanced With Fiducial Support (Source Code)

Important: I discontinued the work for fiducialtuioas3. If you are starting a new project, consider using our new AS3 Tuio library Tuio AS3. As you most certainly came here because you want to use fiducials in AS3 find the according Tuio AS3 fiducial howto here.

In his Bachelor thesis Frederic Frieß enhanced the original Touchlib TUIO AS3 classes with support for fiducials (or to speak in TUIO terms with support for /tuio/2dobj messages).

fiducialtuioas3 Google code

Thus, the Touchlib’s TUIO classes can simply be replaced with Frederic’s classes and everything should still work as before. However, there is one slight change in the package structure: the TUIO classes are now lying inside the package tuio and not in the package flash.events.

I have made Frederic’s Tuio Fiducial AS3 classes available on Google code in a project called fiducialtuioas3.

If you want to use reacTIVision fiducials in Flash, Flex or Adobe Air you are heartily invited to use these classes in your private and professional project.

Examples of what has been done so far with those classes:
Tangible Vispol
Pf Design Media Installation

If you have a nice project with fiducialtuioas3 it would be great if you shared a link with us via mail or in the comments.

Posted in Actionscript, Adobe Air, Flash, flex, Hochschule RheinMain, Multi-Touch, Tangible Interfaces Tagged with: Adobe Air, Flash, flex, Multi-Touch, tangible
  • Cool! Thanks for sharing.

  • Just watched the demo video. This looks great!
    I’m looking forward to trying it out.

  • Chalrie

    For the TUIO test, why can the code only register fiducial #4? How can I change
    this so it supports all of the fiducials in the reactivision library?

  • //track fiducial #5:
    var testProp5:PropObject = tuioManager.getProp(5);
    var testPropHandler5:TestFiducialHandler = new TestFiducialHandler();
    addChild(testPropHandler5);
    testProp.addTUIOPropEventListeners(testPropHandler5);

    //also track fiducial #160:
    var testProp160:PropObject = tuioManager.getProp(160);
    var testPropHandler160:TestFiducialHandler = new TestFiducialHandler();
    addChild(testPropHandler160);
    testProp.addTUIOPropEventListeners(testPropHandler160);

    //… and so on. just add those 4 lines for every fiducial you want to track.

    //pretty easy, isn’t it?

  • gavin

    can you give example of a handle for a gesture such as touch or pinch?

    great work…

  • hi gavin,
    you can find lots of examples on how to use touch and gestures in the as3 touchlib framework on which fiducialtuioas3 is based.

    take a look e.g. into the RotatableScalable class. There you can find basic support for moving, scaling and rotation of pictures. You can use RotatableScalable with fiducialtuioas3. all you should have to do is to add following import path in the class:
    import tuio.*;

    cheers

  • Jacob

    Hi johannes,

    First of, great work!
    We are currently programming a multitouch project where we have to use light pens to write in a flash app. when using your libs we get all the blobs into our flash app. but we would like it to use a “mouseOver” function, do you know a way to do so?
    Also how to remove the red circles(blob indicators) from the scene.

    Hope you can help

    Jacob

  • hi jacob,
    are the light pens working with infrared light (just like the ones from johnny chung lee did)?

    if so, i see problems when you are trying to discern touches from pen interaction because e.g. the Touchlib, CCV or Touché will recognize both as touch interaction. if you are only using light pen interaction it should however work fine. if you want to use mouseOver functionality just create a listener like this in the class that offers the mouseOver functionality:

    1
    
    addEventListener(TouchEvent.MOUSE_OVER, listenerFunction);

    The MOUSE_OVER event is being triggered in tuio.TUIOObject in line 89.

    >> Also how to remove the red circles(blob indicators) from the scene.
    In the class tuio.TUIOCursor in lines 10-17 the circles are being drawn. You can just delete those lines if you don’t need the circles. But the circles are grey and not red, aren’t they?

  • bella

    Hi Johannes, how do I replace finger tracking as mouse?
    please and thank you..

  • Could you be a bit more precise with your question? I have not understood what you want to know from me… sorry!

  • bella

    Thanks for replying,

    I am planning to build an interactive table, I am able to work out the fiducial but I can’t understand the multitouch.

    When I touch the table, does it mean the blob works as a cursor?
    I don’t know how to make blob interact with an object on stage.

  • hi bella,
    as soon as you get a touch (or blob) on your table that is detected by an open source tracking software like CCV, touchlib or touché, the tracking software sends the detected touch via TUIO protocol over the network to connected applications. usually, the applications and the tracking software run on the same computer but nonetheless the touch is sent via TUIO over localhost to the application. Now, your application has to decide what to do with the received TUIO message. There are quite a few programming libraries that support TUIO (actually I am a co-author of the TUIO programming library TUIO AS3 for Flash). you can develop your own applications based on TUIO or you can download a few demo applications that use TUIO.

    if you want to use touches as mouse clicks, you can translate blobs to mouse clicks (at least as far as i know) with the tracking software touchlib. however, this feels really awkward and i would not recommend to do this because there can be many touches at once on a table (hence ‘multi-touch’) so your mouse cursor would jump all the time.

    hope i could help you.

    cheers

  • Bella

    hi again, can i programme by using fiduicialtuio as3 classes only for the touch?
    The blobs can be detected by using reactivision, but how do I make it interact with another movie clip on stage?

    Thanks again

  • can i programme by using fiduicialtuio as3 classes only for the touch

    yes, you can.

    but how do I make it interact with another movie clip on stage

    I’m afraid you have to figure this out on your own…

  • Anne

    Hello Johannes, thanks for sharing the code! Really help me on my project.

    I have different Handler actionscript for different fiducial prop.
    How can I make two different fiducial to react to each other?

    I tried hit test many times but error access was undefined.

    Hope you can help.

  • @Anne I would do it as you said: draw a sprite under each prop and check after each movement whether both sprites hit each other, e.g. via http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/DisplayObject.html#hitTestObject()

  • Shantanu

    Hi Johannes

    This is what my config file looks like

    Globals {
    binary-server-port = “0″
    xml-handshake-port = “0″
    xml-server-port = “0″
    }

    TUIOSender {
    /* The features that should be enabled, options are: [fingers hands objects silent].
    “fingers” – Send finger tip locations
    “hands” – Enable the TUIO Hand Extension and send palm / finger connectivity information.
    “objects” – Send marker information
    “silent” – Do not print TUIOSender output messages
    To enable multiple features, just put multiple keywords into the field.
    The default value is “fingers objects” */
    features = “fingers objects”
    /* address: The TUIO stream receiver IP network address, default = 127.0.0.1 */
    address = “192.168.1.76″
    /* port: The TUIO stream receiver IP port, default = 3333 */
    port = “3333″
    }

    NetBridge {
    host = “192.168.1.76″
    port = “5502″
    input-translate = “0 0″
    input-rotate = “0″
    input-scale = “1 1″
    }

    this config file is located in C:\Users\(pc name)\AppData\Roaming\MultiTouch

    My application with touch inputs work with this configuration, but they are still inconsistent, and sometimes the app crashes automatically, informing me to update my Adobe AIR, which I have. My application still crashes, and the touch input only works at times and not always.

    My markers don’t work at all.

    I have tried different combinations within the config file. The hardware that I am using is a MultiTaction cell.

    For touch input, I used the GestureManagerExample demo example
    For marker input, I used the TUIOAS3FiducialExampleFlash demo example

    Please let me know how to proceed

    Thanks

  • see my answer here.