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 same as constructing a string at runtime and
trying to run it.  Eval() will do that in JS, but there is no AS
equivalent.

Some options are:

1) There are some AS3 eval() functions in third-party libraries.  But they
are unlikely to be fast.
2) You can send the string to a server, compile it into a SWF and load
that SWF and run it.
3) If the function doesn't require much information from the rest of the
app, you could write the string to JS and call eval on it via
ExternalInterface

-Alex

On 11/6/13 2:02 PM, "A. P. Damien" <apdam...@ca.rr.com> wrote:

>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 work? Or is it always legal to do this from inside the class?
>
>
>------------------------------------
>
>--
>Flexcoders Mailing List
>FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
>Alternative FAQ location:
>https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e
>62079f6847
>Search Archives: 
>http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo Groups Links
>
>
>

Reply via email to