Darcey,

In addition to what others are suggesting here, to call that example method first, I
*think* what you might need to add to this component are opposing
"increaseFrustrationLevel" and "decreaseFrustrationLevel" methods that set a boolean,
"ripItOut" in the variables scope.

Then you need another method that checks the frustrationLevel expressed in the
variables.ripItOut boolean and acts accordingly. If you want to get sophisticated
about it, you can provide more levels that a simple boolean will handle and get
numeric about it, but for me, a boolean is almost always enough.

I have a tendency to run my hands through my hair when i get frustrated, and you can
really see what type of a day i've had from the amount left on my desk. :-)


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Behalf Of Darcey Spears
Sent: Wednesday, December 17, 2003 7:10 PM
To: [EMAIL PROTECTED]
Subject: [CFCDev] "Variables" scope....tearing out hair


Hi,
Trying to figure out what I'm doing wrong here.....I'm using this example
from Sean's CF Coding Standards:

<cfcomponent>

     <cffunction name="example">
         <cfset var localVar = "Just in this function" />
         <cfset variables.nonPublicVar = "Non-public data member" />
         <cfset anotherNonPublicVar = "Not recommended - use 'variables'" />
         <cfset this.publicVar = "Public data member" />
     </cffunction>

     <cffunction name="more">
         <cfset var localVar = "Different to example localVar" />
         <cfset var x = variables.nonPublicVar & " set in 'example' above" />
     </cffunction>

</cfcomponent>

Display CFM page has:

<cfobject name="someVarTest"
component="wherestom_working.dirPackage.standards_var_example">

<cfinvoke
  component="#someVarTest#"
  method="more">
</cfinvoke>

I've also tried just a direct invocation of the "more" method:
<cfinvoke
  component="wherestom_working.dirPackage.standards_var_example"
  method="more">
</cfinvoke>

and no matter what I do with variables.nonPublicVar it just doesn't seem to
be defined or available outside the method where it's created. I get an
error saying "nonPublicVar is not defined in Variables" every time I try to
use it.

I'm running CFMX 6.1 on Windows XP with the default installation.

I must be doing something wrong....but what??? My understanding is that
"variables" scope variables are available to all methods in the component
in which they are defined.

Thanks for any help you can provide to keep my hair actually attached to my
head... =:0
Darcey



Darcey Spears
Q3Studios Collaborative Web Development
www.q3studios.com
520-360-5425


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

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

An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]


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

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

An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]

Reply via email to