well actually there is a solution simply
use something like
string=' Group { children [ ' + node
+ '' etc
Is this suposed to be inside url:"javascript"
before "Browser.creatVRMLfromSTRING(string) "?
do I need to route "string" out to "root.addchildren"
or someother static node.addchildren to make it work?
where node is a SFNode field which USEes
the actual node in the scene.
Also this trick for adding ROUTEs
to/from the main scene from the
dynamically added objects.
1) store the MFNode created by
CreateVrmlFromString in a temporay node.
Can you specify how? just "creatVRMLfromString()"
it will not generate any output as I know--then it is stored in
temp node?
2) have the mainscene node in a SF or MF
Node field
Is it already in a MFnode, should we do anything else?
3) use Browser.addRoute(tempNodes
[0], 'isActive', Control, 'isActive');
Why even I knew the DEFed nodes name, I still can not get
any result.
Should I route the eventout "string" to something like
root.addchildren ?
Does below anything wrong! Please help me check it
Thanke
#VRML V2.0 utf8
Sound {
minBack 20
minFront 20
maxBack 50
maxFront 50
source DEF SOUND AudioClip {
url "Shoot.wav"
}
}
DEF GROUP Transform {
}
DEF CREATOR Script {
eventOut MFNode newChildren
directOutput TRUE
url "javascript:
function initialize() {
newVRML = ' Group { children [';
newVRML += ' DEF SENSOR TouchSensor {}';
newVRML += ' Shape { ';
newVRML += ' geometry Box { ';
newVRML += ' size .7 .2 .7 ';
newVRML += ' } ';
newVRML += ' } ] } ';
newChildren = Browser.createVrmlFromString(newVRML);
Browser.addRoute(SENSOR,'touchTime',SOUND,'startTim
e');
}"
ROUTE CREATOR.newChildren TO GROUP.addChildren