#VRML V2.0 utf8 WorldInfo { info "2000/9/20 by GoGoGo, http://www1.plala.or.jp/Studio_GoGoGo/" title "Texture On/Off 2/4" } NavigationInfo {type "EXAMINE"} Viewpoint {} #Box DEF TS TouchSensor {} DEF SW Switch { choice [ Shape { appearance Appearance { material Material {} } geometry Box {} } Shape { appearance Appearance { material Material {} texture ImageTexture {url "sign.gif"} } geometry Box {} } ] } #Script DEF SC Script { eventIn SFTime touchTime eventOut SFInt32 whichChoice field SFBool texOn FALSE url "javascript: function initialize(){ whichChoice=0; } function touchTime(value){ if(!texOn){ texOn=TRUE; whichChoice=1; } else { texOn=FALSE; whichChoice=0; } }" } ROUTE TS.touchTime TO SC.touchTime ROUTE SC.whichChoice TO SW.set_whichChoice