coll and javascript

Feb 2, 2007 at 8:50pm

coll and javascript

I posted this to javascript list, but main list seems to be more
frequent, so i’m trying here, too.

I’m doing my first javascript attempt in max. I read javascriptinMax
guide, but didn’t find anything that seemed useful.

I wonder if it’s possible to make an array in javascript, and connect
it to coll (or some other data storage object), so that I can write,
read and change data in both in max world and javascript?

klif

#30090
Feb 2, 2007 at 9:32pm

Yes, output the array with the data and the index in the same format
as you would package data in ‘max land’, and connect the two.

so make your array, and something like (in psuedo code)

for (i = 0; i< =array.length; i++)
{
outlet(0, i, array[i]);
}

which would output for an array containing array{a,b,c,d,e,f)

0, a
1,b
2,c
3,d
4,f

which would overwrite the data at the index. If you wanted to clear
the coll before, just do an outlet(0, “clear”) before your for loop.
Perhaps there is a better way, but thats how ive been doing it.

On Feb 2, 2007, at 3:50 PM, klif wrote:

> I posted this to javascript list, but main list seems to be more
> frequent, so i’m trying here, too.
>
>
> I’m doing my first javascript attempt in max. I read
> javascriptinMax guide, but didn’t find anything that seemed useful.
>
> I wonder if it’s possible to make an array in javascript, and
> connect it to coll (or some other data storage object), so that I
> can write, read and change data in both in max world and javascript?
>
> klif

v a d e //

http://www.vade.info
abstrakt.vade.info

#95399
Feb 2, 2007 at 10:38pm

ok, so actually i have to manually dump/update both array and coll
every time i change something….

is there any way to have javascript and max share the same array and
update automatically? maybe using jitter?

anyway, probably the best way is to use javascript array as coll. the
only difference is that i can’t open the data in text format, without
doing some additional steps.

#95400
Feb 3, 2007 at 11:47am

On 2-Feb-2007, at 23:38, klif wrote:

> ok, so actually i have to manually dump/update both array and coll
> every time i change something….
>
> is there any way to have javascript and max share the same array
> and update automatically? maybe using jitter?

If it’s an array you could share data with a table by using the refer
message. IMS the C API will let you bind to a table’s data pool, in
which case the JScript API might let you do the same. You’d have to
dig a bit in the documentation to find details.

————– http://www.bek.no/~pcastine/Litter/ ————-
Peter Castine +–> Litter Power & Litter Bundle for Jitter
Universal Binaries on the way
iCE: Sequencing, Recording &
Interface Building for |home | chez nous|
Max/MSP Extremely cool |bei uns | i nostri|
http://www.dspaudio.com/ http://www.castine.de

#95401
Feb 3, 2007 at 2:32pm

On Feb 3, 2007, at 12:47 PM, Peter Castine wrote:

> On 2-Feb-2007, at 23:38, klif wrote:
>
>> ok, so actually i have to manually dump/update both array and coll
>> every time i change something….
>>
>> is there any way to have javascript and max share the same array
>> and update automatically? maybe using jitter?
>
> If it’s an array you could share data with a table by using the
> refer message. IMS the C API will let you bind to a table’s data
> pool, in which case the JScript API might let you do the same.
> You’d have to dig a bit in the documentation to find details.

Unfortunately, I have to store strings and alphanumerics. So table
won’t help in this case.

Thanx anyway

#95402

You must be logged in to reply to this topic.