Yes, you can. Example:

//the function:
function myFunction (inputname){
        trace("hello "+inputname+" from myFunction");
}

//the string:
theStringOfFunction = "myFunction";

//run it with a parameter too:
this[theStringOfFunction]("Patrick") ;
//or:
eval(theStringOfFunction)("Patrick") ;


Jason Merrill   |   E-Learning Solutions   |  icfconsulting.com










>>-----Original Message-----
>>From: [EMAIL PROTECTED] [mailto:flashcoders-
>>[EMAIL PROTECTED] On Behalf Of Patrick Jean
>>Sent: Wednesday, March 22, 2006 10:58 AM
>>To: [EMAIL PROTECTED] Figleaf. Com
>>Subject: [Flashcoders] It exists in director but in flash ?
>>
>>Is there any way in Flash 8 to tell the compiler to run a string as if
it
>>was a method ? See the exemple below :
>>
>>
>>
>>var tempString:String;
>>
>>tempString = "anObject.doSomething()"
>>
>>
>>
>>and having the string being interpreted as a command ? I thought I
could do
>>that with eval but it doesn't seem to work.
>>
>>
>>
>>I remember that with Director you could use the "do" command using a
string,
>>what was pretty convenient.
>>
>>
>>
>>Thanks
>>
>>
>>
>>Patrick Jean
>>
>>Directeur de projets internet
>>
>>Monac'OH Data Mercantour
>>
>>http://www.monacoh.com
>>
>>
>>
>>_______________________________________________
>>Flashcoders@chattyfig.figleaf.com
>>To change your subscription options or search the archive:
>>http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>
>>Brought to you by Fig Leaf Software
>>Premier Authorized Adobe Consulting and Training
>>http://www.figleaf.com
>>http://training.figleaf.com
NOTICE:
This message is for the designated recipient only and may contain privileged or 
confidential information. If you have received it in error, please notify the 
sender immediately and delete the original. Any other use of this e-mail by you 
is prohibited.
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to