Vincent,

> > Is there any work being done to allow the use of JavaScript objects as
> > callbacks in event listeners?  Or is this being saved for a later date
> > (a lower priority)?
>
> I am not sure I understand your question. You can already add event
> handlers attributes with ECMAScript code in your SVG content and,
> through scripting, you can add event listeners, such as:

Adobe's SVG Viewer allows me to use a JavaScript object as an event handler.
The object needs a handleEvent method to follow the EventListener interface.
For example, the following code creates a Button object that handles various
mouse events for a specific svg node.


button = new Button();

someSVGNode.addEventListener(mousedown, button, false);
someSVGNode.addEventListener(mousemove, button, false);
someSVGNode.addEventListener(mouseup, button, false);

function Button() {
    ...
}

Button.prototype.handleEvent = function(e) {
    var type = e.type;

    if ( this[type] != null ) this[type](e);
};

Button.prototype.mousedown = function(e) { ... }
Button.prototype.mousemove = function(e) { ... }
Button.prototype.mouseup = function(e) { ... }

When I try this in Batik, I get the following error: Cannot convert [object
Object] to org.w3c.dom.events.EventListener.  So, I'm wondering if it is or
will be possible to use JavaScript objects as event listeners.

Thanks,
Kevin
KevLinDev - http://www.kevlindev.com


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to