screen is done.  app is done.  touchlib installed.  what now?
Posted: 11 March 2008 02:03 AM   [ Ignore ]
New Member
Rank
Total Posts:  14
Joined  2008-03-11

what is required to get the values taken from touchlib to communicate to the computer and read them as mouse events for flash?  i believe someone told me that all i needed was a flash app that was built for touchlib, but couldn’t find anything within the program.  i’m guessing it’s a downloadable add-on.

anyways, any help is appreciated.  thanks!

Profile
 
 
Posted: 11 March 2008 04:30 AM   [ Ignore ]   [ # 1 ]
Sr. Member
Avatar
RankRankRank
Total Posts:  271
Joined  2007-09-07

hey… i m not sure if you grabbed touchlib from the forums or whitenoize’s blog… just grab the beta 2 ver of touchlib from here >> http://nuigroup.com/zip/touchlib_beta_v2.0.zip ... the root directory contains three .bat files ... config.bat to run thru the configuration routine to calibrate your cam with the projection. once you are done configuring… run the server.bat (you need java runtime libraries installed for this) .. this is the missing link between touchlib and flash app in your case. then run vision.bat (or OSC.exe from your version of touchlib)… and finally the flash app… should work now!!!

hope this helps…

cheers

PS : it is important to run the server before starting the flash app or else they won’t communicate with each other smile

 Signature 

cheers!!!

deej
http://therealdesktop.blogspot.com

Profile
 
 
Posted: 13 March 2008 08:16 PM   [ Ignore ]   [ # 2 ]
New Member
Rank
Total Posts:  14
Joined  2008-03-11
deej - 11 March 2008 04:30 AM

hey… i m not sure if you grabbed touchlib from the forums or whitenoize’s blog… just grab the beta 2 ver of touchlib from here >> http://nuigroup.com/zip/touchlib_beta_v2.0.zip ... the root directory contains three .bat files ... config.bat to run thru the configuration routine to calibrate your cam with the projection. once you are done configuring… run the server.bat (you need java runtime libraries installed for this) .. this is the missing link between touchlib and flash app in your case. then run vision.bat (or OSC.exe from your version of touchlib)… and finally the flash app… should work now!!!

hope this helps…

cheers

PS : it is important to run the server before starting the flash app or else they won’t communicate with each other smile

any links you can point me to get those java runtime libraries at?  thanks

Profile
 
 
Posted: 13 March 2008 08:32 PM   [ Ignore ]   [ # 3 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  549
Joined  2006-11-09

http://java.com/en/download/

 Signature 

~

Profile
 
 
Posted: 13 March 2008 08:41 PM   [ Ignore ]   [ # 4 ]
New Member
Rank
Total Posts:  14
Joined  2008-03-11
c.moore - 13 March 2008 08:32 PM

http://java.com/en/download/

thanks for that!

i was looking at the code here http://nuigroup.com/wiki/Basic_Touchlib_Application/

and was wondering do i need to use those same exact functions in my flash code for touchlib and the server to recognize the events?  or is touchlib and the flashapp going to work as an emulator to register those touches as mouse events?

Profile
 
 
Posted: 13 March 2008 08:54 PM   [ Ignore ]   [ # 5 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  549
Joined  2006-11-09

import flash.display.Sprite;
import flash.events.*;

// Init Touch API
TUIO.initthis 'localhost'3000''true );

// Draw Button
var n_sprite = new Sprite();
n_sprite.graphics.beginFill(0x000000);
n_sprite.graphics.drawRect(0,0,100,100);
this.addChild(n_sprite);

// Mouse
n_sprite.addEventListener(MouseEvent.MOUSE_DOWNdownFunction);

// Touch
n_sprite.addEventListener(TouchEvent.MOUSE_DOWNdownFunction);

public function 
downFunction(e:Event){
trace
(e);
}

Here is a general list of current “TouchEvents” :

MOUSE_DOWN
MOUSE_MOVE
MOUSE_UP
MOUSE_OVER
MOUSE_OUT



Related Threads:
http://nuigroup.com/forums/viewthread/1316/
http://nuigroup.com/forums/viewthread/1402/

 Signature 

~

Profile
 
 
Posted: 13 March 2008 09:13 PM   [ Ignore ]   [ # 6 ]
New Member
Rank
Total Posts:  14
Joined  2008-03-11

ouch so everything in my code that is a mouseevent needs to be converted to a touchevent?  so for example

beat1.addEventListener(MouseEvent.MOUSE_DOWN, startdrag1);

would need to be

beat1.addEventListener(TouchEvent.MOUSE_DOWN, startdrag1);

also is this code needed in my actionscript coding?

TUIO.init( this , ‘localhost’, 3000, ‘’, true );

sorry for the questions guys.  just trying to figure this out

Profile
 
 
Posted: 13 March 2008 09:45 PM   [ Ignore ]   [ # 7 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  549
Joined  2006-11-09

Yes you have to add TouchEvents to your flash ... you don’t convert.. you just add.

Yes you need the TUIO.init().. this opens up the socket to talk to Touchlib

 Signature 

~

Profile
 
 
Posted: 13 March 2008 10:11 PM   [ Ignore ]   [ # 8 ]
New Member
Rank
Total Posts:  14
Joined  2008-03-11
c.moore - 13 March 2008 09:45 PM

Yes you have to add TouchEvents to your flash ... you don’t convert.. you just add.

Yes you need the TUIO.init().. this opens up the socket to talk to Touchlib

so i added the code

TUIO.init( this , ‘localhost’, 3000, ‘’, true );

and added extra event listeners for all my mouse events as touch events, but im getting the following errors when trying to compile my exe file:

“1120: Access of undefined property TUIO” as well as the same exact error for each touch event.

Profile
 
 
Posted: 20 March 2008 11:45 AM   [ Ignore ]   [ # 9 ]
New Member
Rank
Total Posts:  14
Joined  2008-03-11

ok so i figured that out and installed the libraries i needed, warning/strict modes are off.  i compiled everything and get no errors.

i compiled a swf and an exe.  mouse events are running fine, but the touch events don’t work when running the simulator/flosc.

any help please?

Profile
 
 
Posted: 20 March 2008 01:55 PM   [ Ignore ]   [ # 10 ]
Sr. Member
Avatar
RankRankRank
Total Posts:  271
Joined  2007-09-07

if u’re using the flosc java executable… then make sure to change the port from 3334 to 3333 before you start it… in case u use the command line executable version then ignore this…

what flash app are you using… from the trunk or you wrote something on your own… maybe toss the source so we can have a look....

cheers!!!

 Signature 

cheers!!!

deej
http://therealdesktop.blogspot.com

Profile
 
 
Posted: 20 March 2008 02:31 PM   [ Ignore ]   [ # 11 ]
New Member
Rank
Total Posts:  14
Joined  2008-03-11

i’m using the trunk svn, not a custom one.  here’s the source code

import flash.display.Shape;
import flash.events.*;

TUIO.initthis 'localhost'3000''true );

beat1.addEventListener(TouchEvent.MOUSE_DOWNstartdrag1);
beat1.addEventListener(TouchEvent.MOUSE_UPstopdrag1);
beat2.addEventListener(TouchEvent.MOUSE_DOWNstartdrag2);
beat2.addEventListener(TouchEvent.MOUSE_UPstopdrag2);
beat3.addEventListener(TouchEvent.MOUSE_DOWNstartdrag3);
beat3.addEventListener(TouchEvent.MOUSE_UPstopdrag3);
beat4.addEventListener(TouchEvent.MOUSE_DOWNstartdrag4);
beat4.addEventListener(TouchEvent.MOUSE_UPstopdrag4);
beat5.addEventListener(TouchEvent.MOUSE_DOWNstartdrag5);
beat5.addEventListener(TouchEvent.MOUSE_UPstopdrag5);
beat6.addEventListener(TouchEvent.MOUSE_DOWNstartdrag6);
beat6.addEventListener(TouchEvent.MOUSE_UPstopdrag6);
beat7.addEventListener(TouchEvent.MOUSE_DOWNstartdrag7);
beat7.addEventListener(TouchEvent.MOUSE_UPstopdrag7);
beat8.addEventListener(TouchEvent.MOUSE_DOWNstartdrag8);
beat8.addEventListener(TouchEvent.MOUSE_UPstopdrag8);
beat9.addEventListener(TouchEvent.MOUSE_DOWNstartdrag9);
beat9.addEventListener(TouchEvent.MOUSE_UPstopdrag9);

//beat1.addEventListener(MouseEvent.MOUSE_DOWN, startdrag1);
//beat1.addEventListener(MouseEvent.MOUSE_UP, stopdrag1);
//beat2.addEventListener(MouseEvent.MOUSE_DOWN, startdrag2);
//beat2.addEventListener(MouseEvent.MOUSE_UP, stopdrag2);
//beat3.addEventListener(MouseEvent.MOUSE_DOWN, startdrag3);
//beat3.addEventListener(MouseEvent.MOUSE_UP, stopdrag3);
//beat4.addEventListener(MouseEvent.MOUSE_DOWN, startdrag4);
//beat4.addEventListener(MouseEvent.MOUSE_UP, stopdrag4);
//beat5.addEventListener(MouseEvent.MOUSE_DOWN, startdrag5);
//beat5.addEventListener(MouseEvent.MOUSE_UP, stopdrag5);
//beat6.addEventListener(MouseEvent.MOUSE_DOWN, startdrag6);
//beat6.addEventListener(MouseEvent.MOUSE_UP, stopdrag6);
//beat7.addEventListener(MouseEvent.MOUSE_DOWN, startdrag7);
//beat7.addEventListener(MouseEvent.MOUSE_UP, stopdrag7);
//beat8.addEventListener(MouseEvent.MOUSE_DOWN, startdrag8);
//beat8.addEventListener(MouseEvent.MOUSE_UP, stopdrag8);
//beat9.addEventListener(MouseEvent.MOUSE_DOWN, startdrag9);
//beat9.addEventListener(MouseEvent.MOUSE_UP, stopdrag9);

var _sound1:Sound = new Sound(new URLRequest("01.mp3"));
var 
_01:SoundChannel _sound1.play(01000);
_01.soundTransform = new SoundTransform(0);

var 
_sound2:Sound = new Sound(new URLRequest("02.mp3"));
var 
_02:SoundChannel _sound2.play(01000);
_02.soundTransform = new SoundTransform(0);

var 
_sound3:Sound = new Sound(new URLRequest("03.mp3"));
var 
_03:SoundChannel _sound3.play(01000);
_03.soundTransform = new SoundTransform(0);

var 
_sound4:Sound = new Sound(new URLRequest("04.mp3"));
var 
_04:SoundChannel _sound4.play(01000);
_04.soundTransform = new SoundTransform(0);

var 
_sound5:Sound = new Sound(new URLRequest("05.mp3"));
var 
_05:SoundChannel _sound5.play(01000);
_05.soundTransform = new SoundTransform(0);

var 
_sound6:Sound = new Sound(new URLRequest("06.mp3"));
var 
_06:SoundChannel _sound6.play(01000);
_06.soundTransform = new SoundTransform(0);

var 
_sound7:Sound = new Sound(new URLRequest("07.mp3"));
var 
_07:SoundChannel _sound7.play(01000);
_07.soundTransform = new SoundTransform(0);

var 
_sound8:Sound = new Sound(new URLRequest("08.mp3"));
var 
_08:SoundChannel _sound8.play(01000);
_08.soundTransform = new SoundTransform(0);

var 
_sound9:Sound = new Sound(new URLRequest("09.mp3"));
var 
_09:SoundChannel _sound9.play(01000);
_09.soundTransform = new SoundTransform(0);

var 
ba:ByteArray = new ByteArray();
var array:Array;

this.addEventListener(Event.ENTER_FRAMEspectrum);
var 
a:Number 0;
var 
b:Number 0;
var 
c:Number 0;

function 
spectrum(event:Event)
{
    
if (beat3.hitTestObject(main) || beat1.hitTestObject(main) || beat2.hitTestObject(main)){
    a 
0;
    
SoundMixer.computeSpectrum(ba,false,0);
    for(var 
i=0<256i=i+12)
        
{
            a 
ba.readFloat();
            var 
num:Number a;
            
main.width 446 num*100;
            
main.height 446 num*100;
        
}
    }
    
else
    
{
        main
.width 446;
        
main.height 446;
    
}
    
    
if (beat4.hitTestObject(main) || beat5.hitTestObject(main) || beat6.hitTestObject(main)){
    a 
0;
    
SoundMixer.computeSpectrum(ba,false,0);
    for(var 
i=0<256i=i+5)
        
{
            b 
ba.readFloat();
            var 
num:Number b;
            
bumpa.width 322 num*100;
            
bumpa.height 322 num*100;
        
}
    }
    
else
    
{
        bumpa
.width 322;
        
bumpa.height 322;
    
}
    
    
if (beat8.hitTestObject(main) || beat7.hitTestObject(main) || beat9.hitTestObject(main)){
    a 
0;
    
SoundMixer.computeSpectrum(ba,false,0);
    for(var 
i=0<256i=i+7)
        
{
            c 
ba.readFloat();
            var 
num:Number c;
            
bumpb.width 446 num*100;
            
bumpb.height 446 num*100;
        
}
    }
    
else
    
{
        bumpb
.width 400;
        
bumpb.height 400;
    
}
}

function startdrag1(e:TouchEvent):void
{
    beat1
.startDrag();
}

function stopdrag1(e:TouchEvent):void
{
    beat1
.stopDrag();
        if (
beat1.hitTestObject(main)) {
            _01
.soundTransform = new SoundTransform(1);
    
}
    
else {_01.soundTransform = new SoundTransform(0);
    
}
}

function startdrag2(e:TouchEvent):void
{
    beat2
.startDrag();
}

function stopdrag2(e:TouchEvent):void
{
    beat2
.stopDrag();
        if (
beat2.hitTestObject(main)) {
            _02
.soundTransform = new SoundTransform(1);
    
}
    
else {_02.soundTransform = new SoundTransform(0);
    
}
}

function startdrag3(e:TouchEvent):void
{
    beat3
.startDrag();
}

function stopdrag3(e:TouchEvent):void
{
    beat3
.stopDrag();
        if (
beat3.hitTestObject(main)) {
            _03
.soundTransform = new SoundTransform(1);
    
}
    
else {_03.soundTransform = new SoundTransform(0);
    
}
}

function startdrag4(e:TouchEvent):void
{
    beat4
.startDrag();
}

function stopdrag4(e:TouchEvent):void
{
    beat4
.stopDrag();
        if (
beat4.hitTestObject(main)) {
            _04
.soundTransform = new SoundTransform(1);
    
}
    
else {_04.soundTransform = new SoundTransform(0);
    
}
}

function startdrag5(e:TouchEvent):void
{
    beat5
.startDrag();
}

function stopdrag5(e:TouchEvent):void
{
    beat5
.stopDrag();
        if (
beat5.hitTestObject(main)) {
            _05
.soundTransform = new SoundTransform(1);
    
}
    
else {_05.soundTransform = new SoundTransform(0);
    
}
}

function startdrag6(e:TouchEvent):void
{
    beat6
.startDrag();
}

function stopdrag6(e:TouchEvent):void
{
    beat6
.stopDrag();
        if (
beat6.hitTestObject(main)) {
            _06
.soundTransform = new SoundTransform(1);
    
}
    
else {_06.soundTransform = new SoundTransform(0);
    
}
}

function startdrag7(e:TouchEvent):void
{
    beat7
.startDrag();
}

function stopdrag7(e:TouchEvent):void
{
    beat7
.stopDrag();
        if (
beat7.hitTestObject(main)) {
            _07
.soundTransform = new SoundTransform(1);
    
}
    
else {_07.soundTransform = new SoundTransform(0);
    
}
}

function startdrag8(e:TouchEvent):void
{
    beat8
.startDrag();
}

function stopdrag8(e:TouchEvent):void
{
    beat8
.stopDrag();
        if (
beat8.hitTestObject(main)) {
            _08
.soundTransform = new SoundTransform(1);
    
}
    
else {_08.soundTransform = new SoundTransform(0);
    
}
}

function startdrag9(e:TouchEvent):void
{
    beat9
.startDrag();
}

function stopdrag9(e: