http://www.tuio.org/?flashのtuioas3リファレンス実装を使用して、TUIOマルチタッチをサポートするように単純なフラッシュ「ドラムセット」アプリケーションを変換しています。
迅速で汚い解決策として、私は人工的なMouseEventをトリガーしようとしていますが、何も起こらないようです:(私のエラーはどこにありますか?これは可能ですか?すでに感謝しています!
コードは次のとおりです。
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...
}
}