title: JavaScript: Problem with a ActiveX-Object and the apply()-Function
body: <p>i have an ActiveX Object (Master) and would like to invoke functions dynamically on it. To do this i use the apply() Function. But sadly the InternetExplorer tells me something along the lines of: "This Object doesn't support this Method". Can someone give me a hint what i could do?</p>
  
  <p>(To test this you also could use a small flash object as Master and call "doSomething" instead of my specific "Initialize".)</p>
  
  <pre><code>function invoke(object, fnName, args)
  {
    return object[fnName].apply(object, args);
  }
  
  function test_it()
  {
    try{
      Master = window.document["Master"];
    }
    catch(e){alert(e);}
    var param = [1,"VC2"]; 
    var ret = invoke(Master, "Initialize", param);
    alert("got: "+ret);
  }
  </code></pre>
  
  <p>For comparsion, this is the apply() Function in action:</p>
  
  <pre><code>function Obj()
  {
    this.msg = function(a, b, c)
    {
        alert("msg: \n a: "+a+"\n b: "+b+"\n c: "+c);
        return "hi";
    }
      return this;
  }
  
  
  function invoke(object, fnName, args)
  {
    return object[fnName].apply(object, args);
  }
  
  function test_it()
  {
    var obj = new Obj();
    var ret = invoke(obj, "msg", [1, 2, 3]);
    alert("got: "+ret);
  }
  </code></pre>