Monday, June 20, 2005

Flash: Constructing a Dynamic Function Call

Sometimes I don't know which function needs to be called until runtime. A good example is callback functions. If I have a function that takes the name of a callback function to execute I need a way to dynamically construct that call. Here's how:
theObject["theFunctionName"](param1,param2);
This is equivalent to:
theObject.theFunctionName(param1,param2);

0 Comments:

Post a Comment

<< Home