package { import flash.events.MouseEvent; import flash.display.MovieClip; import com.touch.TouchLibrary; import com.touch.TouchEvent; public class Example extends MovieClip { private var touchLib:TouchLibrary; public function Example():void { touchLib = new TouchLibrary(stage);//create an instance of the touchlibrary touchLib.addEventListener(TouchEvent.CONNECT, onFLOSCConnection); touchLib.addEventListener(TouchEvent.CALIBRATION_COMPLETE, onCalibrationComplete); //configure listeners touchLib.connect();//connect to flosc stage.addEventListener(MouseEvent.MOUSE_DOWN, onStageMouseDown); //we'll add a mouseEvent for comparison stage.addEventListener(TouchEvent.FINGER_DOWN, onStageFingerDown); //configure listeners for mouse and finger event } private function onFLOSCConnection(event:TouchEvent):void { if (event.params.success) { touchLib.calibration();//show calibration to define the stage position on the screen } } private function onCalibrationComplete(event:TouchEvent):void { touchLib.blobsVisible(true);//show blobs on the positions where you touch the screen } private function onStageMouseDown(event:MouseEvent):void { trace("clicked at" + stage.mouseX + "," + stage.mouseY); } private function onStageFingerDown(event:TouchEvent):void { trace("touched at" + event.params.stageX + "," + event.params.stageY); } } }