[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[x3d-public] unload x3d file to load another with SAI



Hi

I'm loading a x3d file in xj3d using SAI but, now I need to unload one
file to load another.

Must I unload the initial x3d file to load the other, or simply replace?

To load the first x3d I use the following code, to load the next file
I simply use the same code but with different URL, is this done
correctly? One world is loaded in top of the other…

I'm getting one bug that I think will not happen if the first world is
unloaded and next load the second world, but I don't know how to do
that.

Thanks
   Nuno


       setDefaultCloseOperation(EXIT_ON_CLOSE);
       Container contentPane = getContentPane();

        // Setup browser parameters
        HashMap requestedParameters = new HashMap();

        // Create an SAI component
        X3DComponent x3dComp =      
BrowserFactory.createX3DComponent(requestedParameters);

        // Add the component to the UI
        JComponent x3dPanel = (JComponent)x3dComp.getImplementation();
        contentPane.add(x3dPanel, BorderLayout.CENTER);

        // Get an external browser
        ExternalBrowser x3dBrowser = x3dComp.getBrowser();

        setSize(800,700);
        show();
        
          // Create an X3D scene by loading a file
        mainScene = x3dBrowser.createX3DFromURL(new String[] { "goblin.x3d" });

        // Replace the current world with the new one
        x3dBrowser.replaceWorld(mainScene);

-------------------------------------------------------------------------
for list subscription/unsubscription,
go to http://www.web3d.org/cgi-bin/public_list_signup/lwgate/listsavail.html