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

    apply() on constructor


      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"]);
      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 :)