Deleting objects dynamically from mjx?

    Jan 21 2011 | 4:33 pm
    Hi max-java-people, I just started using java in max (hurrah!). I've created an external that creates buffers dynamically, using dropfile to provide the path to the sample. It works fine... My question is: How do you delete objects dynamically? (is it possible?) I know you can get/reference the objects (in this case buffers) using getNamedBox("mySample01"); but I can't figure out how to delete them. I have looked through the java-doc several times. Maybe I can't see the forest from trees...

    • Nov 17 2011 | 1:12 pm
      you can delete objects with MaxPatcher().remove( MaxBox )
      you get your actual "thispatcher" from a MaxObject with getParentPatcher(); you get your MaxBox with getParentPatcher().getNamedBox(); you remove the box with getParentPatcher( getNamedBox().remove() );