Forums > Javascript

MaxObj.js == null

April 8, 2006 | 2:17 pm

Hello.

The "js" data member of MaxObj javascript object that refer to [js] max objects seems to not contain a reference of the jsthis object, as far as I can understand.

Here is a patch that shows the bug. Another problem (not a potential bug) is indicated in the comment of the patch.

Is it a bug or my fault?

Thanks,

Maurizio.

max v2;
#N vpatcher 591 55 1220 508;
#P window setfont "Sans Serif" 12.;
#P comment 66 322 399 9109516 There seems not even way to check if they wrap the same C object.;
#P window linecount 2;
#P comment 49 276 399 9109516 Moreover , trying to get the javascript wrapper for the [js] object , results in different javascript objects.;
#P window linecount 1;
#P newex 424 154 84 9109516 loadmess set;
#P comment 438 189 68 9109516 "maxclass";
#P message 278 188 159 9109516 js;
#P noclick;
#P message 94 188 159 9109516 null;
#B color 6;
#P noclick;
#P newex 278 154 74 9109516 prepend set;
#P newex 94 154 74 9109516 prepend set;
#P button 94 52 65 0;
#P newex 94 123 194 9109516 js jsthat.js;
#P objectname me;
#P window linecount 4;
#P comment 163 52 276 9109516 js (jsthis , get) If the Maxobj refers to an object is of Max class js , this returns the associated jsthis object;
#B color 7;
#P window linecount 1;
#P comment 67 190 26 9109516 "js";
#B color 7;
#P comment 290 126 70 9109516 < --- it's me!;
#P comment 28 246 399 9109516 When I bang , I see that the "js" of the Maxobj member is always null.;
#P connect 5 0 4 0;
#P connect 4 0 6 0;
#P fasten 11 0 8 0 429 182 99 182;
#P lcolor 1;
#P connect 6 0 8 0;
#P connect 4 1 7 0;
#P fasten 11 0 9 0 429 182 283 182;
#P lcolor 1;
#P connect 7 0 9 0;
#P pop;

jsthat.js:

autowatch = 1;
outlets = 2;

function dumpobj(obj, name) {
if (name) {
post(name + ":", "n");
}
for (var k in obj) {
post(" ", k + ":", String(obj[k]), "n");
}
}
dumpobj.local = 1;

function bang() {
var a = patcher.getnamed("me"), b = patcher.getnamed("me");
dumpobj(a, "a");
dumpobj(this, "this");
dumpobj(this.box, "this.box");
post("this.box == a is", String(this.box == a), "n");
post("a == b is", String(a == b), "n");
outlet(1, a.maxclass);
outlet(0, String(a.js));
}


Viewing 1 post (of 1 total)