Skip to content

AS3 touch library for read CCV TCP/FlashXML data , TUIO UDP/TCP or TouchEvents from other devices and dispatch MouseEvent's and TouchEvent's on flash display list like native devices

Notifications You must be signed in to change notification settings

hyp-cpp-hcx/AS3TouchLib

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

:: AS3TouchLib ::

If You like to use latest lib , please contact me by email . Thare are some key changes I didnt upload yet.

Small , easy to use , pure AS3 library for reading touch data and dispatching Touch or Mouse events on DisplayObjects .
Library allow to add own extensions and data parsers , so You dont have to edit any file to setup own data types .

How it works : connect to socket , emulate touch using build-in functions or recive (TouchLib can automaticly choose data type) and parse bytes , dispatch events on display list just like mouse or touch interaction .

.

This is stable release .

.

@ Formats :

Supported formats :
  • CCV TCP (binary socket)
  • CCV flash XML
  • TUIO TCP
  • TUIO UDP (with AIR)
  • formated TouchEvents (FlashEvents , described lower)

@usage

Basic initalize :

To quick init , use TouchManager initialize functions :

import com.nuigroup.touch.TouchManager;
TouchManager.initConnection(stage);

This code will create Socket , connect to localhost on port 3000 and listen for data .

To customize address , port and output/input mode , You can use params :

import com.nuigroup.touch.TouchManager;
import com.nuigroup.touch.TouchOutput;
import com.nuigroup.touch.TouchProtocol;

TouchManager.initConnection(stage , "192.168.1.5" , 3333 , TouchProtocol.CCVINPUT , TouchOutput.TOUCH );

Touch manager will connect to address , listene for CCV data type and dispatch TouchEvent’s .

Initialize with own Socket connection :

import com.nuigroup.touch.TouchManager;
import com.nuigroup.touch.TouchOutput;
import com.nuigroup.touch.TouchProtocol;

TouchManager.initSocket(stage, socket , TouchProtocol.FLASHEVENT , TouchOutput.MOUSE);

This code will listen for socket data in FlashEvents mode and dispatch MouseEvent’s

About Input/Output :

input (TouchProtocol)

Input element inform about format of incomming data . Build-in functions to parse binary data contains TouchProtocol class .
To set input , use code :

import com.nuigroup.touch.TouchManager;
import com.nuigroup.touch.TouchProtocol;

TouchManager.inputMode = TouchProtocol.FLASHEVENT

output (TouchOutput)

Output provide 2 modes : MouseEvent or TouchEvent .

import com.nuigroup.touch.TouchManager;
import com.nuigroup.touch.TouchOutput;

TouchManager.outputMode = TouchOutput.MOUSE
//or
TouchManager.outputMode = TouchOutput.TOUCH

h4@ Advanced usage :

Lib is ready to add own extensions without any code change .
For this You can look into at TouchCore class or simply add function using TouchManager :

import com.nuigroup.touch.TouchManager;
import flash.utils.IDataInput;

function YourParseFunction(data:IDataInput):void {
    // Your code
}
// ParserName is title for index in object than contain parsers
// You can always switch to other parser and back to this by set 
// TouchManager.inputMode = "ParserName";
// Head is begging of binary message . Head is for automode that automaticly compare header with begging of message
// and choose parser .
// last boolean value define inputMode , if true - input mode is set to this parser
TouchManager.addParser("ParserName" , "Head" , YourParseFunction , true);

This code will add parse function and set it as input.

@authors

NUIGroup.com community
as3 development : Gerard Sławiński || turbosqel
test and support : Christian Moore

About

AS3 touch library for read CCV TCP/FlashXML data , TUIO UDP/TCP or TouchEvents from other devices and dispatch MouseEvent's and TouchEvent's on flash display list like native devices

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published