'this' scope, you'll be able to set the variable just as you think you
should. However, if you don't use a scope, or use the variables scope, you
will be unable to change the variable from outside the component.
Public data members should reside in the 'this' scope, but all private
instance data should reside in a structure within the 'variables' scope. I
use 'my', because I don't like to type, but the most common is 'instance'.
So you'd have something like this:
variables.instances.myVarName = "hello";
What you proposed (somethin like this):
o = createObject("component", "path.to.cfc");
o.myVarName = "hello";
Is the same as having this inside your CFC:
this.myVarName = "hello";
Cheers,
barneyb
> -----Original Message-----
> From: Andrew Scott [mailto:[EMAIL PROTECTED]
> Sent: Monday, December 01, 2003 5:53 PM
> To: CF-Talk
> Subject: CFC and variables
>
> Anyone out there tell me why this is not legit:-)
>
> After creating a component with createobject, I wanted to
> change a variable
> within the object.
>
> o_Instance.VariableName = 'Variable new Value';
>
> Now cfmx doesn't throw a wobbly, but it doesn't change the
> variable either.
> Anyone got any idea why?
>
>
>
> Regards
> Andrew Scott
> Technical Consultant
>
> NuSphere Pty Ltd
> Level 2/33 Bank Street
> South Melbourne, Victoria, 3205
>
> Phone: 03 9686 0485 - Fax: 03 9699 7976
>
>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

