#VRML V2.0 utf8 PROTO Textswitch [ exposedField SFVec3f translation 0 0 0 exposedField SFVec3f scale 1 1 1 exposedField SFRotation rotation 0 1 0 0 exposedField MFString string "Place your text here" exposedField SFNode appearance Appearance {material Material {diffuseColor 1 1 1}} exposedField SFNode fontStyle FontStyle {justify "MIDDLE" family ["SANS"]} eventIn SFBool isOver ] { DEF onMouseOver Script { eventIn SFBool mouseOver IS isOver eventOut SFInt32 choice url "javascript: function initialize() { choice = -1; } function mouseOver() { if (mouseOver) { choice = 0; } else { choice = -1; } } " } DEF displayString Switch { whichChoice 0 choice [ Transform { translation IS translation scale IS scale rotation IS rotation children [ Shape { appearance IS appearance geometry Text { string IS string fontStyle IS fontStyle } } ] } ] } ROUTE onMouseOver.choice TO displayString.whichChoice } Viewpoint { position 0 0 20 } Transform { children [ Shape { geometry Box {} } DEF touch TouchSensor {} ] } DEF description Textswitch { } ROUTE touch.isOver TO description.isOver