Forums > Javascript

bugreport: patcher object not initialized before loadbang when duplicating abstraction.

November 12, 2006 | 7:01 pm

Dear cycling,

I use a loadbang to post the varname of the containing patcher but I get the following errors:

• error: js: getName.js: Javascript TypeError: this.patcher.box has no properties, line 2
• error: js: error calling function bang

This only happens when duplicating or reloading the abstraction that contains the javascript. When I load the whole patch, it works. When I trigger the js with patchergs, everything is fine.

Steps to reproduce:
1) save the patches below
2) load openMe.pat, the max window will show ‘withLoadbang’ and ‘withPatcherargs’
3) duplicate the abstraction ‘withPatcherargs’. the max window will show ‘withPatcherargs[1]‘
4) duplicate the abstraction ‘withLoadbang’. the max window will show the error messages

Max 4.5.7. on Windows XP

save as "withLoadbang.pat":

#P newex 18 47 45 9109513 loadbang;
#P newex 18 68 66 9109513 js getName.js;
#P connect 1 0 0 0;

save as "withPatcherargs.pat":

#P newex 65 55 43 9109513 sel done;
#P newex 18 34 57 9109513 patcherargs;
#P newex 65 76 66 9109513 js getName.js;
#P connect 2 0 0 0;
#P connect 1 1 2 0;

save as "openMe.pat":

#P newex 16 33 74 9109513 withPatcherargs;
#P objectname withPatcherargs;
#P newex 97 33 64 9109513 withLoadbang;
#P objectname withLoadbang;

save as "getName.js":

function bang()
{
post(this.patcher.box.varname);
post();
}

Hope you can confirm,
Mattijs


November 12, 2006 | 7:12 pm

On 12 nov. 06, at 20:01, Mattijs Kneppers wrote:

> Dear cycling,
>
> I use a loadbang to post the varname of the containing patcher but
> I get the following errors:
>
> • error: js: getName.js: Javascript TypeError:
> this.patcher.box has no properties, line 2
> • error: js: error calling function bang

Hi,

Did you tried the loadbang() method from the object?

Best,
ej


November 13, 2006 | 9:24 pm

Quote: Emmanuel Jourdan wrote on Sun, 12 November 2006 20:12
—————————————————-
> Hi,
>
> Did you tried the loadbang() method from the object?
>

Yeah, it has the same problem.

> Best,
> ej
>
>
—————————————————-


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