This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > VRML > May 2004 > how to extrasc string?





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 how to extrasc string?
M.Starzykowski

2004-05-20, 7:34 pm

Hello

Has anybody got idea how to extract single char from
MFString?

I tried this:

#to field into incoming data from counter = 1,2,3,...n
#from field out single char should be send to string field in Text node
#all ROUTE under script (not shown) are OK

DEF GeneratorTextu Script {
eventIn SFInt32 into
eventOut MFString out
field MFString napis ["some char for checking generator"]
url ["java script: function into (value){
out = new MFString( napis[value] );
}
"]}


But ISDN {It Still Does Nothing), cortona show string "undefined"

thanks in advance

Marcin
Joerg Scheurich aka MUFTI

2004-05-21, 9:29 am

> Has anybody got idea how to extract single char from
> MFString?


> DEF GeneratorTextu Script {
> eventIn SFInt32 into
> eventOut MFString out
> field MFString napis ["some char for checking generator"]
> url ["java script: function into (value){
> out = new MFString( napis[value] );
> }
> "]}


> But ISDN {It Still Does Nothing), cortona show string "undefined"


napis[value] is the value.th string of the napis, but napis currently
have only one string.

For cosmoplayer, i have success with

function into (value){
out = new MFString(napis[0].charAt(value));
}

so long
MUFTI
--
Dann Presse <treten Sie ein>
(aus einem Softwarehandbuch)


M.Starzykowski

2004-05-23, 12:09 pm

Hello

Thanks for answer.
It working with cortona too.

regards
Marcin



> For cosmoplayer, i have success with
>
> function into (value){
> out = new MFString(napis[0].charAt(value));
> }
>
> so long
> MUFTI

M.Starzykowski

2004-05-24, 7:17 pm

hello

one questions more :
is it possible to check how many rows are in MFString
ex. ["jjj","ll","lki"] = three rows.
field. I didnt find that function in javascript.

regards
Marcin
Joerg Scheurich aka MUFTI

2004-05-24, 7:17 pm

> one questions more :
> is it possible to check how many rows are in MFString
> ex. ["jjj","ll","lki"] = three rows.


http://www.web3d.org/x3d/specificat....html#TableC.23

| Table C.23 -- MFString property

| Property
| Description
| numeric length
| property for getting/setting the number of elements
| in the array.

so long
MUFTI
--
Cecile Muller

2004-05-24, 11:14 pm

> is it possible to check how many rows are in MFString
> ex. ["jjj","ll","lki"] = three rows.
> field. I didnt find that function in javascript.


Use arrayvariable.length for that. An example:

----------
#VRML V2.0 utf8

Script{
field MFString myStrings ["jjj","ll","lki"]
url "java script:
function initialize(){
trace('Number of rows: ' + myStrings.length);
trace('First row: ' + myStrings[0]);
trace('First character: ' + myStrings[0].charAt(0));
trace('First 2 characters of the third row: ' + myStrings[2].substring(0,2));
}
"
}
----------
M.Starzykowski

2004-05-25, 12:18 pm

Hello

Thanks for all answers


Marcin
Sponsored Links


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