Packagecom.doitflash.tools
Classpublic class DynamicFunc
InheritanceDynamicFunc Inheritance Object

With the help of this class you can convert strings into function calls. your string must be in the following format, as you can see, we have the function name as myFunc and you may optionally send different styles of arguments to that function, it supports arguments in form of simple strings, arrays or objects. myFunc(val1,val2,[arr1,arr2,arr3],{var1:value1,var2:value2,var3:value3}) function myFunc($str1:String, $str2:String, $arr:Array, $obj:Object):void { trace($str1); trace($str2); trace($arr); trace($obj); }

View the examples



Public Properties
 PropertyDefined By
  funcName : String
[read-only] returns the function name in string type
DynamicFunc
  inputs : Array
[read-only] returns all arguments, if any, for the function.
DynamicFunc
Public Methods
 MethodDefined By
  
DynamicFunc($str:String)
initialize the class and send your string to be converted to a function call.
DynamicFunc
Property Detail
funcNameproperty
funcName:String  [read-only]

returns the function name in string type


Implementation
    public function get funcName():String
inputsproperty 
inputs:Array  [read-only]

returns all arguments, if any, for the function.


Implementation
    public function get inputs():Array
Constructor Detail
DynamicFunc()Constructor
public function DynamicFunc($str:String)

initialize the class and send your string to be converted to a function call.

Parameters
$str:String

See also

Examples
The following example shows how a string is converted to an actuall function call.
     var myString:String = "myFunc(value,value2,[arr1,arr2,arr3],{var1:value1,var2:value2,var3:value3})";
     var df:DynamicFunc = new DynamicFunc(myString);
     this[df.funcName].apply(null, df.inputs);
     
     function myFunc($str1:String, $str2:String, $arr:Array, $obj:Object):void
     {
             trace($str1);
             trace($str2);
             trace($arr);
             trace($obj);
     }