Access to [coll] content from javascript code?
Hi,
Through a javascript code, is there a way I can access the content of a [coll]?
Thanks for your helps and hints!
NP
You need to give your [coll] a name. Then you can use it within JS code using [coll]'s message.
Here is an exemple (only some lines of code from a old project, so it is of course not working) with a table, called "intervalles". In function updateTable(), I empty the table and put new values in it.
var thePatcherTable ;
function loadbang ()
{
thePatcherTable = this.patcher.getnamed("intervalles");
}
function updateTable()
{
thePatcherTable.message ("clear");
for (i=0; i
thePatcherTable.message ("list", i, octave1[i] + offsetForTable);
for (i=0; i
thePatcherTable.message ("list", i+octave1Size, octave2[i] + offsetForTable);
outlet (0, octave1Size + octave2Size);
}
Ooopps, something happened after I edited my message to correct a typo. I wish there was a preview. Here is the code again.
function loadbang ()
{
thePatcherTable = this.patcher.getnamed("intervalles");
}
function updateTable()
{
thePatcherTable.message ("clear");
for (i=0; i
thePatcherTable.message ("list", i, octave1[i] + offsetForTable);
for (i=0; i
thePatcherTable.message ("list", i+octave1Size, octave2[i] + offsetForTable);
outlet (0, octave1Size + octave2Size);
}
With maxobj.message() you can't retrieve the already stored contents, only send a message to the object. To do this you'd probably need to script connections from the [coll] outlets to your [js] and then send the [coll] a "dump" message.
lh