RE: [flexcoders] Function from string?

2013-11-07 Thread Keith Reinfeld
I would like to be able to take a function name I've read from the script and call the corresponding function. Hi A. P. Damien, As I understand it, you have existing functions which you want to call by passing the name of a function as a string to a generic method. By 'script' I take

RE: [flexcoders] Function from string?

2013-11-06 Thread Keith Reinfeld
Perhaps the following syntax will help: var func:String = yourFunctionName; this[func](); Regards, Keith Reinfeld From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of A. P. Damien Sent: Tuesday, November 05, 2013 10:48 AM To:

Re: [flexcoders] Function from string?

2013-11-06 Thread hamann . w
I'm writing a game. Well, actually I guess it's more of a game engine. I want the game logic to be in a script. The script will take the form of a series of rooms, each of which can contain: . doors to other rooms . characters the player can interact with . things the player

Re: [flexcoders] Function from string?

2013-11-06 Thread A. P. Damien
On 11/6/2013 9:16 AM, Keith Reinfeld wrote: Perhaps the following syntax will help: var func:String = “yourFunctionName”; this[func](); Thanks. I hadn't fully assimilated the fact that an object can also be treated as an array. Do I have to declare the class 'dynamic' for this trick to

Re: [flexcoders] Function from string?

2013-11-06 Thread Alex Harui
Both Array and Object support [] property access. Regarding converting a String to a Function: AS is compiled, not interpreted, so only strings that have been compiled into functions can be run. You can fill an object or array full of functions and choose one at runtime, but that is not the