ParallelGraphics Forums
General
You are here: [Forums]::[General]

Registration 
Registration
Forgot your password?

Help 
Help
Support

Quick search 

Subscribe to newsletters 

Install Cortona VRML Client for FREE!
Outline 3D
Try RobinZone!
email:  password:
  General

Subject: Re: Reading Text-Files
Sender: Waldi 27.07.07 04:04
I wanna get some settings for the scene from Textfile. Is there any possibility to read Text-Files (*.txt) with VRML or JavaScript???
No. You can't read plain text file with javascript in VRML. But there is some kind a trick: you can save all settings in the VRML file and read it using Browser.createVrmlFromURL(). Just like this, for example,
PROTO Settings [
    field MFString values []
]{
}

Settings {
    values ["var1=value1", "var1=value2", "etc"]
}

Thanks for the fast answer! I've tried it this way, but it doesn't work. What is wrong??
---- PROTO ------
PROTE Settings[
field MFString values[]
]
{}
Settings {values ["full = TRUE", "color = blue", "do = null"]}
-----------------
---- Main -------
...
DEF Group Group{}
Script{
field SFNode g USE Group
field MFString file "settings.wrl"
url "javascript:
function initialize()
{
Browser.createVrmlFromURL(file, g, 'addChildren');
print(settings.children);
...
}
"
}
-----------------

 


Reading Text-Files / Waldi / 26.07.07 07:30
     Re: Reading Text-Files / nalex@parallelgraphics.com / 26.07.07 07:46
         Re: Reading Text-Files / denizfb81@hotmail.com / 4.10.07 12:49
         Re: Reading Text-Files / Waldi / 27.07.07 04:04
             Re: Reading Text-Files / nalex@parallelgraphics.com / 27.07.07 05:49
                 Re: Reading Text-Files / Waldi / 27.07.07 07:08

Messages in thread: 6


© 1998-2007 ParallelGraphics. All rights reserved. Terms of use.