<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.0//EN" "https://www.web3d.org/specifications/x3d-3.0.dtd">
<![CDATA[
ecmascript: // setting the value of an eventOut variable also sends it as an event // you can view the output of print statements in the VRML Console function toggle ( value, ts ) { // only toggle on click (isActive true) not release (isActive false) if ( value == false ) return; if ( state == true ) { state = false; stateTurnedFalse = true; Browser.println ('ToggleScript.state = ' + state + ', stateTurnedFalse = ' + true); } else { state = true; stateTurnedTrue = true; Browser.println ('ToggleScript.state = ' + state + ', stateTurnedTrue = ' + true); } }
]]>
<![CDATA[
ecmascript: // setting the value of an eventOut variable also sends it as an event function setStart ( value, timeStamp ) { startEventTime = timeStamp; Browser.println ('TimeFilter.setStart (' + value + '), startEventTime = ' + timeStamp); Browser.println (); // newline } function setStop ( value, timeStamp ) { stopEventTime = timeStamp; Browser.println ('TimeFilter.setStop (' + value + '), stopEventTime = ' + timeStamp); Browser.println (); // newline }
]]>
Event Graph ROUTE Table entries with 5 ROUTE connections total, showing X3D event-model relationships for this scene.
Each row shows an event cascade that may occur during a single timestamp interval between frame renderings, as part of the X3D execution model.
Touch
TouchSensor isActive SFBool |
ToggleScript
Script toggle SFBool |
then |
ToggleScript
Script stateTurnedFalse SFBool |
TimeFilter
Script setStop SFBool |
then |
TimeFilter
Script startEventTime SFTime |
Audio
AudioClip set_startTime SFTime |
|||
then |
TimeFilter
Script stopEventTime SFTime |
Audio
AudioClip set_stopTime SFTime |
||||||||
then |
ToggleScript
Script stateTurnedTrue SFBool |
TimeFilter
Script setStart SFBool |
then |
TimeFilter
Script startEventTime SFTime |
Audio
AudioClip set_startTime SFTime |
|||||
then |
TimeFilter
Script stopEventTime SFTime |
Audio
AudioClip set_stopTime SFTime |
<!--
Online at
https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Chapter30Scripts/Figure30_3ScriptSoundActivateIndex.html
-->
<!--
Version control at
https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Chapter30Scripts/Figure30_3ScriptSoundActivate.x3d
-->
<!--
Color legend: X3D terminology
<X3dNode
DEF='idName' field='value'/>
matches XML terminology
<XmlElement
DEF='idName' attribute='value'/>
(Light-blue background: event-based behavior node or statement)
(Grey background inside box: inserted documentation)
(Magenta background: X3D Extensibility)
-->
<!-- For additional help information about X3D scenes, please see X3D Tooltips, X3D Resources, and X3D Scene Authoring Hints. -->