0 Replies Latest reply on Feb 4, 2013 6:46 AM by dasdeckone

    ExternalObject callbacks

    dasdeckone

      i just posted this question as a part of another question:

      http://forums.adobe.com/message/5045935#5045935

       

      i thought i might decouple the two to wurther explain what i'm trying to do.

       

      basicly i want my indesign plgin/script to react to socket messages.

       

      i don't see how to do it with the javascript socket (and i really want to use javascript to reuse my library) so i looked at the external object wich looked promising as it seemed to get me

      all c/c++ can do, which is basicly everything .

       

      but i can not see how to call a javascript callback from c/c++.

       

      here is some pseudocode:

       

       

      function onLibChange(someData)
      {
           //..do somehting
      }
      
      var ext = new ExternalObject("lib:mylib");
      ext.addCallback(onLibChange);
      

       

      i want to execute the passed function form my lib at any time in the future.

      i also tried passing an object.

       

       

      function Listener()
      {
      }
      Listener.prototype.onChange = function (someData)
      {
           //..do somehting
      }
      
      var ext = new ExternalObject("lib:mylib");
      var listener1 = new Listener();
      ext.addCallback(listener1);
      

       

      but i seem to only get a string in the c/c++ side of things (kTypeString)...nothing i could execute or call back :|