Forums > Javascript

messnamed() function question

May 27 2007 | 10:05 pm

I’m trying to write some JavaScript code that will allow me to create a jit.window object dynamically and then send a "jit_matrix" message to that window object. I can easily create the jit.window object from within JavaScript, but I’m having difficulty sending the jit_matrix message to it and having it respond.

In my JavaScript code I have:

var window01 = new JitterObject("jit.window");
window01.rect = [200, 200,216, 216];
window01.border = 0; = "window01";

var bwMatrix = new JitterMatrix( 1, "char", 16, 16 );

function bang()
var column = getRandom(16);
var row = getRandom(16);
bwMatrix.setcell(column, row, "val", 255);
messnamed("window01", "jit_matrix", );
function getRandom( max )
return Math.floor( Math.random() * max );
getRandom.local = 1;

In the associated Max patcher, I have a qmetro object sending a bang message to the JavaScript code every 200 ms. The jit.window object appears correctly sized and positioned, but the window contents do not change when the bang() function is called. No error messages are produced in the Max window. Clearly, my understanding for the requirements of messnamed() is deficient. I was hoping someone could enlighten me about how to accomplish this, or perhaps direct me to some coding examples of how it’s done.

Do I need to make the window01 a Max "global receive" object?

Thanks in advance.

May 27 2007 | 10:32 pm

Never mind. I discovered a more-direct way to accomplish what I want to do. I just need to send the movie object a jit_matrix message directly by invoking the object’s jit_matrix() method.

Sorry for generating forum noise!


Viewing 2 posts - 1 through 2 (of 2 total)

Forums > Javascript