Closed splace closed 5 years ago
This will never work. Because you define a field with name 'val' it is globally available in the Script. Then you define a function with the name val in the global scope which overrides the field value. The JavaScript engine will assign this function to the field val which results then in the error. Whether or not it will work it is not legal JavaScript. A field handler function for a exposedField always starts with 'set_'+name of the field to make a distinction between the field and the field handler function, in the example above the function must be renamed to 'set_val'.
Besides this exposedFields are not allowed as user-defined Script fields in VRML, the are first introduced in X3D 3.0.
This will never work
// working for non-MF type.)
just saying.
Besides this exposedFields are not allowed as user-defined Script fields in VRML, the are first introduced in X3D 3.0.
AFAIK that is incorrect;
'exposedField' --> 'inputOuput'
A field handler function for a exposedField always starts with 'set_'+name of the field
i assume you mean when there is ambiguity, clearly you don't always need to do that.
but when this happens, i would think a better/clearer way would have been just to decompose the exposedField; inputOnly 'set_val' and outputOnly 'val_changed'
seems this was done, for some/one browser, as a simple way to implement a forwarded exposed field, that is, have the same event out as came in.
also
the error message above is the same as when you access an array with an 'out-of-range' index (or maybe undefined index)
cut down to min. demo from PROTO found online.
console output..