// AJAX3D2c.js 20061015 20070424 (tutorial2.js) var timeSensor = null; var AjaxTextMaterial = null; var X3DTextMaterial = null; function setupListeners() { // Get a handle to the TimeSensor node timeSensor = web3Dbrowsercontext.getNode("Timer"); // Get handles to the Shape nodes AjaxTextMaterial = web3Dbrowsercontext.getNode("AjaxTextMaterial"); X3DTextMaterial = web3Dbrowsercontext.getNode("X3DTextMaterial"); // Set up the observers that detect mouse click on the geometry setListenerObserver("TouchSensorajax", "touchTime", AjaxSensorTouched); setListenerObserver("TouchSensorx3d", "touchTime", X3DSensorTouched); } function AjaxSensorTouched(f, t) { // Set X3D material color of each Shape AjaxTextMaterial.diffuseColor.r = 0; AjaxTextMaterial.diffuseColor.g = 0.75; AjaxTextMaterial.diffuseColor.b = 0; X3DTextMaterial.diffuseColor.r = 0.5; X3DTextMaterial.diffuseColor.g = 0; X3DTextMaterial.diffuseColor.b = 0.5; // Set HTML Status text statusArea.innerHTML = "Ajax Sensor Clicked."; } function X3DSensorTouched(f, t) { // Start X3D animation timeSensor.startTime = t; // Set HTML Status text statusArea.innerHTML = "X3D Sensor Clicked."; }