I quickly made the video last night and removed it straight after it was uploaded to youtube :( To bad youtube is compressing so much, I already used a 800x600 resolution. Should have increased the fontsize as well. Anyway most of the things written in the video are also there in the Example.as so I hope people will know what to do if they read that.
Anyway I would like to add that it currently only supports the following commands:
TouchEvent.CONNECT
Dispatched when the connection to FLOSC succeeded or failed.
The object contains the following parameters.
- *success*:Boolean - the connection result: true if the connection succeeded; false if the connection failed.
- *error*:String - an error message if connection failed.
TouchEvent.CALIBRATION_COMPLETE
Dispatched when calibration is complete.
No parameters are available.
TouchEvent.FINGER_DOWN
Dispatched when a finger touches the object.
TouchEvent.FINGER_UP
Dispatched when a finger is released from the object.
TouchEvent.FINGER_MOVE
Dispatched when a finger moves over the object.
The object contains the following parameters.
- *id*:Number - a number indicating the finger id.
- *event*:String - a string containing the event name.
- *localX*:Number - a number indicating the screen x position, between 0 and 1.
- *localY*:Number - a number indicating the screen y position, between 0 and 1.
- *stageX*:Number - a number indicating the stage x position.
- *stageY*:Number - a number indicating the stage y position.
- *deltaX*:Number - a number indicating the delta x.
- *deltaY*:Number - a number indicating the delta y.
- *distance*:Number - a number indicating the distance from the delta x/y.
- *areaWidth*:Number - a number indicating the area width around the blob.
- *areaHeight*:Number - a number indicating the area height around the blob.
The Touch!Library has the following public functions:
/**
* Function: connect
*
* Establish a connection to the FLOSC.
*
* Parameters:
* host - the ip address of the FLOSC instance (default is localhost).
* port - the port of the FLOSC instance (default is 3000).
*
* Return:
* Nothing. Causes the <TouchEvent.CONNECT> event to be fired in response.
*
* Example:
* (start code)
* touchlib.connect("127.0.0.1", 3000)
* (end)
*/
/**
* Function: disconnect
*
* Closes the current connection to FLOSC.
*
* Parameters:
* None.
*
* Return:
* Nothing.
*
* Example:
* (start code)
* touchlib.disconnect()
* (end)
*/
/**
* Function: blobsVisible
*
* Shows (true) or hides (false) the drawn circles around the detected blobs.
*
* Parameters:
* visible - a boolean value determining whether or not to show the blobs.
*
* Return:
* Nothing.
*
* Example:
* (start code)
* touchlib.blobsVisible(true)
* (end)
*/
/**
* Function: calibration
*
* Loads the calibration process to define the stage position on the screen.
*
* Parameters:
* None.
*
* Return:
* Nothing.
*
* Example:
* (start code)
* touchlib.calibration()
* (end)
*/
/**
* Function: startDrag
*
* Starts to drag the objecy.
*
* Parameters:
* fingerId - a number indicating the finger id.
* sprite - the sprite that needs to be dragged.
*
* Return:
* Nothing.
*
* Example:
* (start code)
* touchlib.startDrag(12, mcExample)
* (end)
*/
/**
* Function: stopDrag
*
* Stops to drag the sprite.
*
* Parameters:
* fingerId - a number indicating the finger id that is dragging the sprite.
* sprite - the sprite that needs to be released (optional; if not given it will release all sprites by the finger id).
*
* Return:
* Nothing.
*
* Example:
* (start code)
* touchlib.stopDrag(12, mcExample)
* (end)
*/