copyball_1d_0_00.x3d source
<?xml version="1.0" encoding="UTF-8"?>
<X3D>
<Scene>
<Viewpoint/>

<NavigationInfo
type='
"EXAMINE"'
/>

<Group DEF='Gp'>
</Group>

<Script DEF='Sc'>
<field accessType='outputOnly' type='MFNode' name='children'/>
<field accessType='initializeOnly' type='SFNode' name='Ball'>
<Shape>
<Appearance>
<Material diffuseColor='1 0 0'/>
</Appearance>
<Sphere/>
</Shape>
</field>
<![CDATA[ecmascript:

function initialize() {

var i = 0;
var balls = new MFNode ();

for ( var x=-2; x<=2; x++ ) {

var Tf = new SFNode ('Transform {}');
Tf.translation[0] = x * 2;
Tf.children[0] = Ball;

balls[i++] = Tf;

}

children = balls;

}
]]>
</Script>

<ROUTE fromNode='Sc' fromField='children' toNode='Gp' toField='children'/>
</Scene>
</X3D>