#X3D V4.0 utf8 PROFILE Immersive # [X3D] version=4.0 # [X3D] noNamespaceSchemaLocation=/specifications/x3d-4.0.xsd # X3D-to-ClassicVRML XSL translation autogenerated by X3dToClassicVrmlEncoding.xslt and X3dToVrml97.xslt # /x3d/content/X3dToClassicVrmlEncoding.xslt # /x3d/content/X3dToVrml97.xslt # Transformation using XSLT processor: Saxonica # [head] META "title" "ECMAScriptSaiTouchSensorIsOverEvent.x3d" META "description" "Java Scene Authoring Interface (JSAI) scene and source code example that demonstrate a scripted response to a TouchSensor isOver event by changing the color of a Box from blue to red." META "creator" "X3D Working Group" META "created" "23 February 2005" META "modified" "28 September 2025" META "reference" "/x3d/content/examples/X3dSceneAuthoringHints.html#Scripts" META "reference" "X3D Abstract Specification, Scripting Component, 9.2.3 Scripting language protocols /specifications/X3Dv4/ISO-IEC19775-1v4-IS/Part01/components/networking.html#ScriptingLanguageProtocols" META "reference" "/files/specifications/19777-1/V3.3/Part1/X3D_ECMAScript.html" META "specificationSection" "X3D language bindings, ISO/IEC 19777-1, Part 1: ECMAScript, B.2 touchSensor isOver event" META "specificationUrl" "/files/specifications/19777-1/V3.3/Part1/examples.html#TouchSensorIsOverEvent" META "generator" "X3D-Edit 4.0, /x3d/tools/X3D-Edit" META "identifier" "/x3d/content/examples/Basic/X3dSpecifications/ECMAScriptSaiTouchSensorIsOverEvent.x3d" META "license" "../license.html" # [Scene] ========== ========== ========== WorldInfo { title "ECMAScriptSaiTouchSensorIsOverEvent.x3d" } Group { children [ Shape { appearance Appearance { material DEF MAT Material { diffuseColor 0 0 1 } } geometry Box { } } DEF TS TouchSensor { } ] } # Note that external url takes precedence, but will fall back to contained CDATA source if no external script is found. DEF SC Script { inputOnly SFBool isOver outputOnly SFColor diffuseColor_changed ### Warning: Note that Script node includes both url and CDATA section of contained code url [ "ECMAScriptSaiTouchSensorIsOverEventScript.js" "/x3d/content/examples/Basic/X3dSpecifications/ECMAScriptSaiTouchSensorIsOverEventScript.js" "ecmascript: function initialize() { } function isOver(val) { if (val == true) { diffuseColor_changed = new SFColor(1,0,0); } else { diffuseColor_changed = new SFColor(0,0,1); } } " ] } ROUTE TS.isOver TO SC.isOver ROUTE SC.diffuseColor_changed TO MAT.set_diffuseColor