message script works.. but not code within .js file?

    Jun 26 2013 | 12:07 am
    I have a question about java script.
    I can send a script message (script newobject led) to [thispatcher] to create an led with no problem. But when I use this.patcher.newobject ("led") inside of a .js file via [js] (with the name of the .js file as its argument)... I get nothing.. only the message "doesn't understand "led" in the Max window.
    I have no problem creating other objects with the same set up.. [button], [message], etc. Why no led? Is there a different name for [led] when referencing it inside of a .js file? I'm confused.

    • May 13 2014 | 4:40 pm
      did you solve this problem?? i had same problems about "led" object. I am goolgling it and i found only your question.
      If you solve this problem, please let me know how to do it.
    • May 13 2014 | 6:14 pm
      I would recommend using newdefault:
      led = this.patcher.newdefault(x, y, "led");
      where x and y are the xy position of the upper left corner of the object. You can then set the patching_rect of the object by doing something like:
      led.patching_rect(100, 100, 60, 60);
    • May 13 2014 | 6:30 pm
      Wow, thanks!
      I already tried newdefault method, but i confused the order of parameters. So, I put the name first on it :( Now, I can make new LED object, but i think still newobject function might have problems...
      anyways thank you very much for help me out !!!