// file "create2.java" when compiled yields "create2.class" import vrml.*; import vrml.field.*; import vrml.node.*; public class create2 extends Script { private SFNode the_parent; private MFString target_url; private BaseNode tmp; private Browser b; public void initialize() { // get hold of the node reference target_url = (MFString) getField("target_url"); the_parent = (SFNode) getField("parentNode"); b = getBrowser(); } public void processEvent(Event e) { // now in response to some input we want to create the new box: createNode(); } private void createNode() { tmp = the_parent.getValue(); String [] urls = new String[target_url.getSize()]; target_url.getValue(urls); try {b.createVrmlFromURL(urls, tmp, "addChildren");} catch(vrml.InvalidVRMLSyntaxException theError) {System.out.println("caught exception");} } }