This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > VRML > April 2006 > contact 5 calling JavaScript from VRML





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author contact 5 calling JavaScript from VRML
Steve Smith

2006-04-21, 7:13 pm

I'm trying to get contact 5.3 to call a script in a html document without
success
Can anyone send me a working example ?

Thanks

Steve Smith

This how its described in the sdk

3. Calling JavaScript from VRML:
Here when the touchTime event occurs, set_string is called in the
script node. The Script method OnEvent() will be called with the specified
parameters.
Of course par1 and par2 can be replaced at runtime by actual parameters.

DEF RotationScript Script {
field MFString newurl [ "OnEvent( par1, par2 )" ]
field MFString param [ "" "" ]
eventIn SFTime clicked
eventIn SFTime set_string
eventOut SFRotation rotation_changed
url "vrmlscript:
function clicked (value, time) {
angle = Math.random()*6.283;
rotation_changed = new SFRotation(0,1,0,angle);
}
function set_string (value, time) {
Browser.loadURL(newurl,param);
}
"
}

ROUTE RotSensor.touchTime TO RotationScript.set_stringand the HTML
definition:<SCRIPT language=Javascript>function OnEvent(par1, par2, time)
{ document.sform.sfield.value = par1 + par2 + time; }</SCRIPT>


Josip Almasi

2006-04-21, 7:13 pm

Steve Smith wrote:
> I'm trying to get contact 5.3 to call a script in a html document without
> success
> Can anyone send me a working example ?


Yep as the example shows you need to bridge it via vbscript.
I use this with vrspace vrml client. To test it enable sun java to
handle applets (ie & contact) then go to
http://vrspace.dyndns.org:8080/vrspace
The code you're interested in is vrspace.html & vrspace.wrl on the above
directory.

Regards...
Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews