messnamed() function question

May 27, 2007 at 10:05pm

messnamed() function question

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.name = “window01″;

var bwMatrix = new JitterMatrix( 1, “char”, 16, 16 );
bwMatrix.setall(0);

function bang()
{
var column = getRandom(16);
var row = getRandom(16);
bwMatrix.setcell(column, row, “val”, 255);
messnamed(“window01″, “jit_matrix”, bwMatrix.name );
}
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.

#32139
May 27, 2007 at 10:32pm

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!

—Steve

#105248

You must be logged in to reply to this topic.