Much better approach!  Cheers for that (to be honest, I didn't even know
*my* way worked until I tried it ;-)

Adam Cameron 
Application Developer 
Straker Interactive 
[EMAIL PROTECTED] 
Fax + 64 9 3605870 
DDI +64 4 4965664 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Nathan Dintenfass

A similar method, if you need the dynamically called method to have
access to the CFC internals might be:

<cfscript>
object  = createObject("component", "yourComp");
 objName  = "object";
 methodName = "yourMethod";
 variables[objName].dynMethod = variables[objName][methodName];
 value= variables[objName].dynMethod();
 writeOutput(value);
</cfscript>

In the original, you are "stripping" the method off the CFC instance and
making it local.  In my method you are "tacking" the dynamic method back
onto the CFC instance.  It only matters if the method you call also
calls private/public methods of the CFC and/or uses instance data of the
CFC.


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Behalf Of Adam Cameron

This works (tested):
<cfscript>
 object  = createObject("component", "yourComp");
 objName  = "object";
 methodName = "yourMethod";
 dynMethod = variables[objName][methodName];
 value= dynMethod();
 
 writeOutput(value);
</cfscript>


----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev' 
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

Reply via email to