Hi Praveen.
Praveen Nayak:
> Using Adobe viewer we could have the same ECMAscript handle both HTML
> and SVG file.
>
> In Batik, it was pointed out to me that SVG can be manipulated from an
> external ECMAScript by accessing the applet and having the applet
> manipulate the SVG file.
> The following Batik example shows that:
>
> http://xmlgraphics.apache.org/batik/demo.html
>
> Is it possible for the Javascript that is a part of the SVG, loaded
> inside the scope of Batik to interact with the Applet hosting the
> canvas?
>
> For example, how can I have a Java method of the applet call a
> ECMAScript function that is inside the SVG content, and/or vice versa?
>
> I would like to complete the circle of interaction - outside javascript
> accessing the applet which in turn accesses the inner ECMAScript, and
> the inner ECMAScript accessing the applet, and the applet talking to the
> outside javascript.
>
> If it would require small changes in the Batik code, I can do that too
> with my local copy - if someone can tell me it's possible and show me
> the right direction.
Yes it is possible, and it shouldn’t need any modifications to Batik.
The method for interacting with the script in the HTML containing the
applet is called LiveConnect. Here’s an example:
import java.applet.Applet;
import netscape.javascript.JSObject;
public class Something extends Applet {
public void start() {
JSObject win = JSObject.getWindow(this);
win.call("someFunction", new Object[] { new Integer(1),
"blah",
new Boolean(false) });
}
}
This calls a script function called someFunction with three arguments:
1, "blah", false.
See:
http://java.sun.com/products/plugin/1.3/docs/jsobject.html
http://docs.rinet.ru/HTMLnya/ch47.htm
Note that this doesn’t work in Internet Explorer, though. If you need
this in IE you can use an ActiveX control that implements the
LiveConnect interfaces:
http://www.mozilla.org/projects/plugins/plugin-host-control.html
HTH,
Cameorn
--
Cameron McCormack, http://mcc.id.au/
xmpp:[EMAIL PROTECTED] ▪ ICQ 26955922 ▪ MSN [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]