Jamie wrote:
I have been using the ASV3 viewer and am currently revising the
ecmascript code to get it to work in Batik/Rhino. I realise that Adobe
have implemented a number of non-standard features. However one feature
that I use extensively is the addEventListener(eventType, listener,
useCapture) method of registering event listeners on a particular node.
Your sample file works fine for me (when I click on the menu Items
I get alerts).
You should be using at least Batik 1.5, or you may want to pick up
current CVS (we make nightly source dumps available as well).
The argument I typically pass to the listener parameter is 'this'. Then
I implement a handleEvent method for the prototype. I have used this
method to define generic event handlers on objects quite successfully. I
have included a file demonstrating this. Note that although this works
fine in ASV3, I am getting the following error in Batik.
org.mozilla.javascript.EvaluatorException: Cannot convert [object
Object] to org.w3c.dom.events.EventListener
at org.mozilla.javascript.DefaultErrorReporter.runtimeError(Unknown
Source)
at org.mozilla.javascript.Context.reportRuntimeError(Unknown Source)
at org.mozilla.javascript.Context.reportRuntimeError(Unknown Source)
at org.mozilla.javascript.Context.reportRuntimeError2(Unknown Source)
at
org.mozilla.javascript.NativeJavaObject.reportConversionError(Unknown
Source)
at org.mozilla.javascript.NativeJavaObject.coerceType(Unknown Source)
at org.mozilla.javascript.NativeJavaMethod.call(Unknown Source)
at
org.apache.batik.script.rhino.EventTargetWrapper$RhinoNativeJavaMethod.call(Unknown
Source)
at org.mozilla.javascript.ScriptRuntime.call(Unknown Source)
at org.mozilla.javascript.gen.c167.call(<SVG>:9)
at org.mozilla.javascript.ScriptRuntime.call(Unknown Source)
at org.mozilla.javascript.gen.c166.call(<SVG>:5)
at org.mozilla.javascript.BaseFunction.construct(Unknown Source)
at org.mozilla.javascript.ScriptRuntime.newObject(Unknown Source)
at org.mozilla.javascript.gen.c171.call(<SVG>:1)
at org.mozilla.javascript.gen.c171.exec(<SVG>)
at org.mozilla.javascript.Context.evaluateReader(Unknown Source)
at org.apache.batik.script.rhino.RhinoInterpreter.evaluate(Unknown Source)
at
org.apache.batik.bridge.BaseScriptingEnvironment$1.handleEvent(Unknown
Source)
at org.apache.batik.dom.events.EventSupport.fireEventListeners(Unknown
Source)
at org.apache.batik.dom.events.EventSupport.dispatchEvent(Unknown Source)
at org.apache.batik.dom.AbstractNode.dispatchEvent(Unknown Source)
at
org.apache.batik.bridge.BaseScriptingEnvironment.dispatchSVGLoad(Unknown
Source)
at
org.apache.batik.bridge.BaseScriptingEnvironment.dispatchSVGLoad(Unknown
Source)
at
org.apache.batik.bridge.BaseScriptingEnvironment.dispatchSVGLoad(Unknown
Source)
at
org.apache.batik.bridge.BaseScriptingEnvironment.dispatchSVGLoadEvent(Unknown
Source)
at org.apache.batik.bridge.UpdateManager.dispatchSVGLoadEvent(Unknown
Source)
at org.apache.batik.swing.svg.SVGLoadEventDispatcher.run(Unknown Source)
I think the key line here is:
at
org.apache.batik.bridge.BaseScriptingEnvironment$1.handleEvent(Unknown
Source)
Why is this? Were should I look for further information about Rhino DOM
bindings.
[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
------------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]