Duplicate works on CFC instances, so Duplicate(this) would work. Of course
it also duplicates the state of the instances variables in 'this', so it
might not be what you want.

Otherwise, try CreateObject("component",GetMetaData(this).name) or
maybe CreateObject("component",GetMetaData(this).fullname). I'm not sure
which is better.

-- Dennis

On 13 July 2011 20:37, Steve Onnis <st...@cfcentral.com.au> wrote:

> Can anyone suggest a way i can create a new reference to a cfc that i am
> already in?****
>
> ** **
>
> Something like....****
>
> ** **
>
> FooBar.cfc****
>
> <cfcomponent>****
>
>       <cfproperty name="fooProp" type="string" />****
>
>       <cffunction name="bar" output="false">****
>
>             <cfscript>****
>
>                   LOCAL.tmpArr = [];****
>
>                   *for* (LOCAL.i = 1; LOCAL.i LTE 10; LOCAL.i = LOCAL.1+1)
> {****
>
>                         LOCAL.tmpObj = *new* this*;*****
>
>                         LOCAL.tmpObj.setfooBar("Some String #LOCAL.i#");**
> **
>
>                         *ArrayAppend*(LOCAL.tmpArr, LOCAL.tmpObj);****
>
>                         }****
>
>             </cfscript>****
>
>       </cffunction>****
>
> </cfcomponent>****
>
> ** **
>
> Obviously “new this;” wont work.****
>
> ** **
>
> I want something to replace ****
>
> LOCAL.tmpObj = *createObject*("COMPONENT", "FooBar");****
>
> ** **
>
> Ideas?****
>
> ** **
>
> Steve****
>
> --
> You received this message because you are subscribed to the Google Groups
> "cfaussie" group.
> To post to this group, send email to cfaussie@googlegroups.com.
> To unsubscribe from this group, send email to
> cfaussie+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/cfaussie?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"cfaussie" group.
To post to this group, send email to cfaussie@googlegroups.com.
To unsubscribe from this group, send email to 
cfaussie+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/cfaussie?hl=en.

Reply via email to