Id check the following: That your referring to the CFC in the same way you
are defining them. (since you say it works when defining with teh functions,
I think this is most likely)
See if there is any difference made by instantiating them within the init
function. The method-access on the other CFCs. That the init function of
external CFCs are returning "this". You could also instantiate them into the
application scope, as long as they are thread-safe, and then refer to them
via the application scope. Hope this helps! >Gah, sorry. The sample is
wrong. The psuedo constructor would look >like this and in the cffunction
would be called by the variables scope. >variables.errorMsg.addErrorMsg() >
>Sorry. was copy/pasting. > ><cfcomponent displayname="feeds" output="false"
...> > <cfscript> > variables.errorMsg = createObject("component",
>"com.util.errorMessages").init(); > variables.iManager =
createObject("component", >"com.util.imageManager").init(); >
variables.instGateway = createObject("component",
>"FeedsGateway").init(application.global); > </cfscript> > >>
On Wed, Nov 25, 2009 at 4:00 PM, Chung Chow <[email protected]> wrote:
>
> Gah, sorry. The sample is wrong. The psuedo constructor would look
> like this and in the cffunction would be called by the variables scope.
> variables.errorMsg.addErrorMsg()
>
> Sorry. was copy/pasting.
>
> <cfcomponent displayname="feeds" output="false" ...>
> <cfscript>
> variables.errorMsg = createObject("component",
> "com.util.errorMessages").init();
> variables.iManager = createObject("component",
> "com.util.imageManager").init();
> variables.instGateway = createObject("component",
> "FeedsGateway").init(application.global);
> </cfscript>
>
> > -----Original Message-----
> > From: Chung Chow [mailto:[email protected]]
> > Sent: Wednesday, November 25, 2009 12:37 PM
> > To: cf-talk
> > Subject: Methods not found.
> >
> >
> > Hi all,
> >
> > I'm trying to instantiate an object either in the
> > psuedo-contructor or init of my cfc as a variable so I can
> > use it within all my method inside that cfc. For some reason
> > when I call a method from that object I get a Method not
> > found error. I'm not sure if this is the best way of going
> > about it so if anyone has a better idea, I'd like to hear
> > about it. :) If I istantiate it WITHIN the cffunction, it
> > works fine. Any ideas?
> >
> > Here's a sample of how I'm doing it. When I try to call
> > addErrorMsg(); or isSuccess() or any methods in errorMsg or
> > Imanage or instGateway it throws a Method not found error.
> >
> > <cfcomponent displayname="feeds" output="false" ...>
> > <cfscript>
> > var errorMsg = createObject("component",
> > "com.util.errorMessages").init();
> > var iManager = createObject("component",
> > "com.util.imageManager").init();
> > var instGateway = createObject("component",
> > "FeedsGateway").init(application.global);
> > </cfscript>
> >
> > <cffunction name="init" access="public" returntype="feeds"
> > hint="Constructor">
> > <cfreturn this>
> > </cffunction>
> >
> > <cffunction name="insertFeedRecord" access="public" ...>
> > <cfargument name="dataset" required="true" type="struct"
> > hint="Passed Dataset" />
> >
> > <cfscript>
> > var feedsBean = "";
> > var newFileName = "";
> > var instGatway = "";
> > var results = structNew();
> >
> > feedsBean = createObject("component",
> > "feedsBean").init(argumentCollection=dataset);
> >
> > // Validate the required fields and do an image upload
> > if (not len(trim( feedsBean.getFeedName() )))
> > errorMsg.addErrorMsg("...Blah");
> > if (not len(trim( feedsBean.getFeedDescription() )))
> > errorMsg.addErrorMsg("...Blah");
> > if (not len(trim( feedsBean.getAuthorName() )))
> > errorMsg.addErrorMsg("...Blah");
> >
> > if (errorMsg.isSuccess()) {
> > results.success = instGateway.create(feedsBean, errorMsg);
> > results.errors = errorMsg.getErrors();
> > }
> > else {
> > results.success = 0;
> > results.errors = errorMsg.getErrors();
> > }
> > </cfscript>
> >
> > <cfreturn results />
> > </cffunction>
> > </cfcomponent>
> >
> >
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know
on the House of Fusion mailing lists
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:328707
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4