instantreality forum
news: Welcome to the instantreality forums!
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
April 24, 2018, 03:38:27 am


Login with username, password and session length


Pages: [1]
  Print  
Author Topic: Creating instance of prototype with Script  (Read 1388 times)
goshanoob
Newbie
*
Posts: 2


View Profile
« on: November 09, 2015, 10:53:07 am »

Hallo! My JS-code is creating instance of prototype than bring scene initialization. Commenting code is done, but script-code is not done. Why!? Healp me, please. Thank you!

<?xml version="1.0" encoding="UTF-8"?>
<X3D version="3.2"> <Scene>
<ProtoDeclare name="proto">
 <ProtoBody>
  <Shape>
   <Box/>
   <Appearance> <Material diffuseColor="0 1 0"/> </Appearance>
  </Shape>
 </ProtoBody>
</ProtoDeclare>

<Transform DEF="box">
   <!--
   <ProtoInstance name="proto">
   </ProtoInstance>
   -->
</Transform >

 <Script DEF="scr">   
   <![CDATA[ ecmascript:
   function initialize(){
     var scen= Browser.currentScene;
     var exemp= scen.createNode("ProtoInstance");
     exemp.name=new SFString("proto");
     scen.getNamedNode("box").addChild(exemp);
     Browser.println(scen.getNamedNode("бокс").children[0].name); // "proto"
   }
   ]]>
 </Script>


</Scene></X3D>
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.15 | SMF © 2011, Simple Machines