The
array doesn??™t contain the class methods and
the uninitialized variables.
hasField(o:Dynamic, field:String) : Bool Returns true if the passed object contains a
field named as the second argument; returns
false otherwise. The method doesn??™t take
into account class methods and uninitialized
variables.
isFunction(f:Dynamic) : Bool Returns true if the argument is a function;
returns false otherwise.
isObject(v:Dynamic) : Bool Returns true if the argument is an object;
returns false otherwise.
makeVarArgs(f:Array
-> Dynamic)
: Dynamic
Transforms a function that takes an array of
arguments into a function that can be called
with any number of arguments.
setField(o:Dynamic, field:String, value:
Dynamic) : Void
Sets the value of the field with the specified
name on the passed object.
Part III: Extending the Possibilities
466
To invoke a method knowing its name at run time, you can use the following code snippet:
var a = Reflect.callMethod(ob, Reflect.field(ob,???execute???), [???abc???, 123]);
Where ob is an object that has a method execute() that accepts two arguments, a string, and an
integer value.
Pages:
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865