0 Replies Latest reply on Jul 19, 2006 12:18 AM by Kiriran

    apply() on constructor

    Kiriran
      Hi

      I'm trying to call the constructor with apply(). I do this because I don't know until runtime how many arguments I have to pass to the constructor (as an array)

      In AS2 the following code works but not in AS3
      ---------
      var arr:Array = Array.prototype.constructor.apply(null, ["Hello", "World"]);
      trace(arr);
      --------
      I know that you can use apply only on functions. trace(Array) is [type Function] in AS2 but [class Array] in AS3. Is there some work arround? I want to use it on any class, not just on array.

      Thanks :)