#VRML V2.0 utf8 WorldInfo { title "Floppy's VRML97 Tutorial Example 25a" info ["(C) Copyright 1999 Vapour Technology" "vrmlguide@vapourtech.com"] } DEF SCRIPT Script { eventIn SFTime touchTime field SFInt32 touchCount 0 field SFInt32 eventCount 0 field MFString tempString "" eventOut MFString outputString url "javascript: function initialize() { outputString = new MFString('',''); tempString = new MFString('',''); outputString[0] = 'Ready...'; } function touchTime(value, time) { touchCount++; tempString[0] = 'touchCount: ' + touchCount.toString(); } function eventsProcessed() { eventCount++; tempString[1] = 'eventCount: ' + eventCount.toString(); outputString = tempString; } " } Transform { translation 0 -.5 8 children [ DEF SENSOR TouchSensor { } Shape { appearance Appearance { material Material { emissiveColor 1 0 0 } } geometry Sphere { radius 0.1 } } ] } Shape { geometry DEF TEXT Text { fontStyle FontStyle { justify "MIDDLE" family "TYPEWRITER" } } } ROUTE SENSOR.touchTime TO SCRIPT.touchTime ROUTE SCRIPT.outputString TO TEXT.string
© Copyright 1999 Vapour Technology - vrmlguide@vapourtech.com - http://www.vapourtech.com/vrmlguide