Transform {
translation -5 98 -118 #the translation in X Y Z directions
children[
Shape{
appearance Appearance{
material Material {diffuseColor 0 0 0 }
}
geometry DEF NameText Text {
fontStyle FontStyle {
justify ["MIDDLE", "MIDDLE"]
family "TYPEWRITER"
style "BOLD"
size 20
}
}
}
]
}
DEF Scr Script {
eventIn SFInt32 keyDown
eventIn SFBool deleteword
field SFNode NameText USE NameText
eventIn SFTime blink
field SFBool showCursor FALSE
field SFString name ""
url "javascript:
function keyDown(value,timestamp){
value=value&255;
if(value==8){
if(name.length>0) name=name.substring(0,name.length-10);
NameText.string[0]=name;}
// showCursor=true;
//NameText.string[0]=name+'|';}
if( value==32 || value>48 && value<100 ){
name=name+String.fromCharCode(value).toUpperCase();
showCursor=false;
NameText.string[0]=name;
if(name.length>100) {name=name.substring(0,name.length-1);
name = name
NameText.string[0] = name;}
}
if(value==13){
//after enter
}
function deleteword(value)
{
if(!value){
NameText.string[0] = ''; }
}
}"
}
DEF C_Eraser-TIMER TimeSensor { cycleInterval 6.667 },
DEF C_Eraser-POS-INTERP PositionInterpolator {
key [0, 0.015, 0.03, 0.045, 0.06, 0.075, 0.09, 0.105, 0.12, 0.135,
0.15, 0.165, 0.18, 0.195, 0.21, 0.225, 0.24, 0.255, 0.27, 0.285,
0.3, 0.315, 0.33, 0.345, 0.36, 0.375, 0.39, 0.405, 0.42, 0.435,
0.45, 0.465, 0.48, 0.495, 0.51, 0.525, 0.54, 0.555, 0.57, 0.585,
0.6, 0.615, 0.63, 0.645, 0.66, 0.675, 0.69, 0.705, 0.72, 0.735,
0.75, 0.765, 0.78, 0.795, 0.81, 0.825, 0.84, 0.855, 0.87, 0.885,
0.9, 0.915, 0.93, 0.945, 0.96, 0.975, 0.99, 1, ]
keyValue [-132.5 102.8 -117, -132.2 102.8 -117, -131.3 102.8 -117,
-129.9 102.8 -117, -127.9 102.8 -117, -125.5 102.8 -117,
-122.7 102.8 -117, -119.4 102.8 -117, -115.8 102.8 -117,
-111.9 102.8 -117, -107.7 102.8 -117, -103.2 102.8 -117,
-98.56 102.8 -117, -93.72 102.8 -117, -88.75 102.8 -117,
-83.67 102.8 -117, -78.53 102.8 -117, -73.37 102.8 -117,
-68.22 102.8 -117, -63.13 102.8 -117, -58.12 102.8 -117,
-53.23 102.8 -117, -48.51 102.8 -117, -43.98 102.8 -117,
-39.69 102.8 -117, -35.68 102.8 -117, -31.97 102.8 -117,
-28.62 102.8 -117, -25.65 102.8 -117, -23.1 102.8 -117,
-21.01 102.8 -117, -19.42 102.8 -117, -18.34 102.8 -117,
-17.49 102.8 -117, -16.78 102.8 -117, -16.21 102.8 -117,
-15.75 102.8 -117, -15.4 102.8 -117, -15.16 102.8 -117,
-15.01 102.8 -117, -14.94 102.8 -117, -15.16 102.8 -117,
-16.3 102.8 -117, -18.35 102.8 -117, -21.21 102.8 -117,
-24.81 102.8 -117, -29.08 102.8 -117, -33.93 102.8 -117,
-39.29 102.8 -117, -45.08 102.8 -117, -51.22 102.8 -117,
-57.64 102.8 -117, -64.25 102.8 -117, -70.97 102.8 -117,
-77.74 102.8 -117, -84.47 102.8 -117, -91.08 102.8 -117,
-97.49 102.8 -117, -103.6 102.8 -117, -109.4 102.8 -117,
-114.8 102.8 -117, -119.6 102.8 -117, -123.9 102.8 -117,
-127.5 102.8 -117, -130.4 102.8 -117, -132.4 102.8 -117,
-133.6 102.8 -117, -133.8 102.8 -117, ] },
ROUTE StartTour.touchTime TO C_Eraser-TIMER.startTime
ROUTE C_Eraser-TIMER.fraction_changed TO C_Eraser-POS-INTERP.set_fraction
ROUTE C_Eraser-POS-INTERP.value_changed TO C_Eraser.set_translation
ROUTE Kbd.keyDown TO Scr.keyDown
How am i going to call the deleteword function after the animation end?
Please advise.


