Forums > Javascript

Javascript within Subpatches

May 7, 2009 | 12:17 pm

Is it possible to have javascript within subpatches (ie: using the patcher object)?

Current have a javascript file within a subpatch, but upon loading the max file the JS objects errors with "cannot find file 1.js" (etc). Moving it to the main patch it works fine.

The *.js file is in the root directory along with the max file, and using the full filename ‘JS C:directorymaxproject1.js’ doesn’t seem to cure it either.

I have had a quick look at the tutorials/manuals but can’t see anything, anyone got a solution?

Cheers Smile


May 7, 2009 | 12:49 pm

Ok, you can push it a ‘compile’ message with the fullpath and filename, but it doesn’t want to update the number of outlets…..

edit – bodged solution is to the set the outlets/inlets arguments within the JS object arguments rather than within the actual javascript file.

Seems to work, although it would be nice if the compile updated the number of outlets on the JS object.


May 7, 2009 | 6:12 pm

If you change the number of inlets or outlets after the object has been instantiated you need to do something like delete the object then command+z or edit > undo to re-instantiate it. Then it should have the correct number of ins/outs.

lh


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