Display Objectクラスでは、イベントを除いてすべてをラップしています。パターンがわからないので、例が必要です。
JavaScriptでは、次のようにオブジェクトのコールバックを作成します。
displayObject.onPress = function(event) {
$wnd.alert("object pressed");
}
マウスイベントパラメータをラップしました:
public class MouseEventImpl extends JavaScriptObject {
protected MouseEventImpl() {}
public static native MouseEventImpl create(String type, int stageX, int stageY, DisplayObjectImpl target, JavaScriptObject nativeEvent) /*-{
return new $wnd.MouseEvent(type, stageX, stageY, target, nativeEvent);
}-*/;
...other methods excluded...
}
public class MouseEvent {
private MouseEventImpl impl;
public MouseEvent(String type, int stageX, int stageY, DisplayObject target, JavaScriptObject nativeEvent) {
this.impl = MouseEventImpl.create(type, stageX, stageY, target.getOverlay(), nativeEvent);
}
...other methods excluded...
}
表示オブジェクトは同じオーバーレイパターンを使用します。Javaでコールバックを記述してJSOに渡すにはどうすればよいですか?可能であれば例を挙げてください。:)