-
18 Feb 2012 3:09 AM #1
Unanswered: How i use SpriteHandler?
Unanswered: How i use SpriteHandler?
Hi, i'm Dong ju.
I wanna add MouseEvent to Sprite.
I find SpriteHandler. But, I can't use this.
i'm fool.. T_T please help me!
//
Before, I succesed in adding MouseEvent to AbsolutePanel.
That is very Simple.. just do this.
public class MyAbsolute extends AbsolutePanel implements HasMouseUpHandler{
@Override
public HandlerRegistration addMouseUpHandler(MouseUpHandler handler) {
return addDomHandler(handler, MouseUpEvent.getType());
}
}
Thanks in advance..
-
21 Feb 2012 2:15 PM #2
Good question. Because events are delegated by the DrawComponent to the sprites that is where you add your handlers. Using the BasicDrawExample you could add a selection handler like this:
Code:DrawComponent component = new DrawComponent(); component.addSpriteSelectionHandler(new SpriteSelectionHandler() { @Override public void onSpriteSelect(SpriteSelectionEvent event) { Info.display("Sprite", event.getSprite().toString()); } });


Reply With Quote