Hi, I'm working on project for drawing some shapes on touch-enabled nokia phones. I chose SVG to draw the shapes. The requirement also includes interactions between users and these shapes. For example, users may tap a circle on the screen to do something. The problem is the mouse event cannot be dispatched to SVG model. What I did like this:
I use SVGAnimator to render all shapes,
---------------------------------------------------------------
SVGImage img = SVGImage.create...
SVGAnimator animator = SVGAnimator.createAnimator(img);
// ... bind to screen display
animator.setSVGEventListener(new SVGEventListener()
{
//...
public void pointerPressed(int x, int y)
{
img.dispatchMouseEvent("click", x, y);
}
//...
});
// ...
SVGElement oneCircle =
(SVGElement)img.getDocument().getElementById("circle1")
oneCircle.addEventListener("click", new EventListener()
{
public void handleEvent(Event evt){
// handle the event
}
}, false);---------------------------------------------------------------
But the event listener registered to the circle was never notified.
Can anybody help me out? is anything I did wrong?

Reply With Quote

