Dynamic amount of Map-buttons (in bpatchers) made with Javascript won't map!

maaark's icon

Hi all,

I've been a Max user for quite a long time now, but using the objects which interface with Live still leaves quite some mystery for me.

I've been designing a patch where I get data in via OSC (not included in example code), and I can map this data using multiple M4L.MapButtonMultiSingle.maxpat in a Bpatchers (in example code!).

I'm using Javascript to dynamically add bpatchers on the fly to my M4L patch.

My problem now is that the dynamically created buttons won't map to a value like they're supposed to!
I'm guessing this is because the live.thisdevice, live.path etc. objects don't work if they're created in this on-the-fly manner in a bpatcher.

How to fix this? So how can I create multiple map-buttons in a dynamic fashion that actually work? See the AMXD file to get a sense of what I mean.

makeDynamicBpatchers_MapButtons.amxd
amxd