Hi!
I am converting a simple flash 'drumset' application to support TUIO multitouch using the tuio as3 reference implementation from http://www.tuio.org/?flash
As a quick and dirty solution, i am trying to trigger an artificial MouseEvent, but nothing seems to happen :( where is my error? is this even possible? thanks already!
here's the code:
package {
import org.tuio.tuio.*;
import org.tuio.osc.*;
import flash.display.*;
import flash.ui.*;
import flash.events.*;
import flash.media.*;
public class drumsets2 extends MovieClip implements ITuioListener {
private var tuio:TuioClient;
var soundS01:Sound = new S01();
// more sounds...
public function drumsets2(){
this.tuio = new TuioClient(new LCConnector());
this.tuio.addListener(this);
drum1.hitS01.addEventListener(MouseEvent.MOUSE_DOWN, playS01);
// more event listeners for sounds...
}
// this is where the 'magic' is supposed to happen
public function addTuioCursor(tuioCursor:TuioCursor):void {
stage.dispatchEvent(
new MouseEvent( MouseEvent.MOUSE_DOWN, true, false, tuioCursor.x*stage.stageWidth, tuioCursor.y*stage.stageHeight )
);
}
function playS01(e:MouseEvent):void
{
var scS01:SoundChannel = soundS01.play();
}
// more play functions...
}
}