Hi Steve,
That's correct the cfc was called steve. I didn't need to import anythign
as I just dropped the cfc in the same folder.
If the cfc was in a folder say com.cfaussie or there was a com mapping the
import would be:
<cfscript>
import com.cfaussie.steven;
temp = new steven("zigZag2");
temp.bar();
writeDump(getMetaData(temp));
</cfscript>
In the cfc it knows where it is so you don't need the import. Also
getMetaData() will return the meta data Phill was mentioning and you could
use fullName to dynamically create the new instance. Return type of init
must be any however as you can't change that at run time.
Eg: http://pastebin.com/ZeE0rpYJ
Running: http://demo.kukiel.net/cfaussie2.cfm
Paul
On Thu, Jul 14, 2011 at 12:23 PM, Steve Onnis <[email protected]>wrote:
> Ok so if i have a cfc named FooBar.cfc, from within that CFC i can make a
> call new FooBar() and i will have a new instance of the CFC?
>
> -----Original Message-----
> From: Paul Kukiel [mailto:[email protected]]
> Sent: Thursday, 14 July 2011 8:55 AM
> To: cfaussie
> Subject: [cfaussie] Re: CreateObject of itself
>
> Hi Steve,
>
> I believe this is what your trying to achieve:
>
> http://pastebin.com/hJmsEvaA
>
> Running code: http://demo.kukiel.net/cfaussie.cfm
>
> Paul
>
> On Jul 13, 8:37 pm, "Steve Onnis" <[email protected]> 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 [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> 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 [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/cfaussie?hl=en.
>
>
--
Paul Kukiel
--
You received this message because you are subscribed to the Google Groups
"cfaussie" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/cfaussie?hl=en.