<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.3//EN" "https://www.web3d.org/specifications/x3d-3.3.dtd">
<X3D profile='Immersive' version='3.3 xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation =' https://www.web3d.org/specifications/x3d-3.3.xsd '>
<head>
<meta name='titlecontent='TestScriptInitialization.x3d'/>
<meta name='descriptioncontent='Test ability to perform Script initialize() method using ECMAsript'/>
<meta name='creatorcontent='Don Brutzman'/>
<meta name='createdcontent='16 February 2008'/>
<meta name='modifiedcontent='20 October 2019'/>
<meta name='referencecontent=' https://X3dGraphics.com '/>
<meta name='referencecontent=' https://www.web3d.org/x3d/content/examples/X3dResources.html '/>
<meta name='rightscontent='Copyright 2006, Daly Realism and Don Brutzman'/>
<meta name='subjectcontent=' X3D book, X3D graphics, X3D-Edit, http://www.x3dGraphics.com '/>
<meta name='identifiercontent=' https://X3dGraphics.com/examples/X3dForWebAuthors/Chapter09EventUtilitiesScripting/TestScriptInitialization.x3d '/>
<meta name='generatorcontent='X3D-Edit 3.3, https://savage.nps.edu/X3D-Edit'/>
<meta name='licensecontent=' ../license.html'/>
</head>
<!--

Index for DEF nodes : DisplayText, Initializer
-->
<Scene>
<WorldInfo title='TestScriptInitialization.x3d'/>
<Shape>
<!-- ROUTE information for DisplayText node:  [from Initializer.initializeResult to string ] -->
<Text DEF='DisplayTextstring='"waiting for" "Script to initialize()..."'>
<FontStyle justify='"MIDDLE" "MIDDLE"'/>
</Text>
<Appearance>
<Material ambientIntensity='0diffuseColor='0 0 0emissiveColor='0 0.398733 1shininess='0.05specularColor='0.622449 0.622449 0.622449'/>
</Appearance>
</Shape>
<!-- ROUTE information for Initializer node:  [from initializeResult to DisplayText.string ] -->
<Script DEF='Initializer'>
<field name='initializeResulttype='MFStringaccessType='outputOnly'/>
<![CDATA[
      
ecmascript:

function initialize ()
{
    scriptName = 'TestScriptInitialization.x3d';
    Browser.print ('[' + scriptName + ' initialize() commmenced...]');

    initializeResult = new MFString ("Script initialize() OK");

    Browser.print ('[...' + scriptName + ' initialize() complete]');
}

    
]]>
</Script>
<ROUTE fromNode='InitializerfromField='initializeResulttoNode='DisplayTexttoField='string'/>
</Scene>
</X3D>
<!--

Index for DEF nodes : DisplayText, Initializer
-->

<!-- Color key: <X3dNode DEF='idName' field='value'/> matches <XmlElement DEF='idName' attribute='value'/>
(Light blue background: behavior node) (Grey background: inserted documentation) (Magenta background: X3D Extensibility)
-->

<!-- For additional help information about X3D scenes, please see X3D Tooltips, X3D Resources and X3D Scene Authoring Hints. -->