Yes, you're exactly right.  When you pull a method out of a CFC, it's
no longer part of the CFC.  In your setter, you're setting
variables.XXX, which outside a CFC, is part of the page's variables
scope.  When you call the extracted getter, it uses the page's
variable scope as well, so it works as well.  Since the CFC doesn't
use the page's variable scope, the in-CFC methods aren't refering to
the same variable, and consequently don't work as expected.

If you want to call a method dynamically, take a look at CFINVOKE. 
You still invoke the method on the CFC instance, but you can pass in a
dynamically computed method name.  Would that meet your need?

cheers,
barneyb

On 8/23/05, Chris Terrebonne <[EMAIL PROTECTED]> wrote:
> I am attempting to dynamically call a cfc's functions without resorting to 
> evaluate, but something isn't working correctly.
> I have read in the archive that you can assign a function to a var, then call 
> the var as a method but this doesn't appear to be working with setters in a 
> cfc.  Take the following code for example:
> 
> tempSetter = myComponent["setID"];
> tempSetter(1);
> 
> Although the function appears to complete without error, the value isn't 
> retained in the myComponent cfc.  It almost appears as if the dynamic 
> function is executing in an entirely different scope.
> 
> If I create another dynamic function call to retrieve the data, it appears to 
> be there, but if I call the function directly, the data isn't there:
> 
> tempGetter = myComponent["getID"];
> writeoutput(tempGetter()); // displays "1"
> writeoutput(myComponent.getID()); //displays nothing
> 
> Is there something I'm missing?
> 
> TIA,
> Chris
> 
> 
-- 
Barney Boisvert
[EMAIL PROTECTED]
360.319.6145
http://www.barneyb.com/

Got Gmail? I have 50 invites.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:216080
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to