在Display Object类中,除了事件之外,我已经包装了所有东西。我无法弄清楚这种模式,真的需要一个例子。如何使用JavaScript Overlay类型(GWT)包装回调?
在JavaScript中,您创建这样的对象的回调:
displayObject.onPress = function(event) {
$wnd.alert("object pressed");
}
我已经包裹Mouse Event参数:
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?如果可以,请提供一个例子。 :)
我 - 让GWT的错误处理和调度工作正常,包装回调到Java在$入口是非常重要的不太确定你为什么使用JavaScript覆盖。你有没有尝试GwtEvent >和一个HandlerManager为你的点击事件?如果需要,我可以解释他们。 – 2012-03-08 04:11:44
EaselJS是一个用于与画布进行交互的库。回调由EaselJS引擎在按下画布的特定部分时调用。不幸的是,我不能使用GwtEvent,因为DisplayObject不是页面元素。 – LoneWolf 2012-03-08 08:43:31
我明白了,我必须自己检查一下 – 2012-03-08 14:58:28