This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > VRML > July 2005 > Can you tell me where is the error in this script? please!





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 Can you tell me where is the error in this script? please!
Uince

2005-06-30, 8:06 pm

Hi.
I'm new to Vrml / x3d can you tell me where is the error here??
I want to change the texture of "tex" when i clik on the touch sensor
bot!!!!!!!


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.0//EN"
"http://www.web3d.org/specifications/x3d-3.0.dtd">
<X3D version="3.0">
<Scene>

<Shape>
<Appearance>
<Material emissiveColor="1 0 0"/>
<ImageTexture DEF="tex" url="pine_t.jpg"/>
</Appearance>
<Sphere/>
</Shape>

<Script DEF="cambiatex" url="esscript.js" directOutput="true"
mustEvaluate="true">
<field name="clik" type="SFBool" accessType="inputOnly"/>
<field name="colore" type="MFString" accessType="outputOnly"/>
</Script>

<Transform translation="3 3 3">
<Shape>
<Cylinder/>
</Shape>
<TouchSensor DEF="bot"/>
</Transform>

<ROUTE fromNode="bot" fromField="isActive" toNode="cambiatex"
toField="clik"/>
<ROUTE fromNode="cambiatex" fromField="colore" toNode="tex"
toField="url"/>
</Scene>
</X3D>



the file essescript.js:

function clik(value,ts) {
colore="pine_2.jpg";
}




MessAnger

2005-07-01, 4:44 am

maybe...

MF~ data type is a kind of array.

so..

colore=3D"pine_2.jpg"; --> colore[0]=3D"pine_2.jpg";




Uince =EC=9E=91=EC=84=B1:
> Hi.
> I'm new to Vrml / x3d can you tell me where is the error here??
> I want to change the texture of "tex" when i clik on the touch sensor
> bot!!!!!!!
>
>
> <?xml version=3D"1.0" encoding=3D"UTF-8"?>
> <!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.0//EN"
> "http://www.web3d.org/specifications/x3d-3.0.dtd">
> <X3D version=3D"3.0">
> <Scene>
>
> <Shape>
> <Appearance>
> <Material emissiveColor=3D"1 0 0"/>
> <ImageTexture DEF=3D"tex" url=3D"pine_t.jpg"/>
> </Appearance>
> <Sphere/>
> </Shape>
>
> <Script DEF=3D"cambiatex" url=3D"esscript.js" directOutput=3D"true"
> mustEvaluate=3D"true">
> <field name=3D"clik" type=3D"SFBool" accessType=3D"inputOnly"/>
> <field name=3D"colore" type=3D"MFString" accessType=3D"outputOnly"/>
> </Script>
>
> <Transform translation=3D"3 3 3">
> <Shape>
> <Cylinder/>
> </Shape>
> <TouchSensor DEF=3D"bot"/>
> </Transform>
>
> <ROUTE fromNode=3D"bot" fromField=3D"isActive" toNode=3D"cambiatex"
> toField=3D"clik"/>
> <ROUTE fromNode=3D"cambiatex" fromField=3D"colore" toNode=3D"tex"
> toField=3D"url"/>
> </Scene>
> </X3D>
>
>
>
> the file essescript.js:
>=20
> function clik(value,ts) {
> colore=3D"pine_2.jpg";
> }


Sponsored Links


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