I would look into setting up Remoting using AS 2.0 if you can. It's a lot
better and there are very good examples found in the Flash dictionary. That
said, are you able to successfully return a result back to flash without doing
any kind of document generating? If so, try doing something like this instead.
Not sure if this will solve your problem but just as a differeny way of how to
approach this with some error checking.... <cfcomponent> <!--- Remoting Call
---> <cffunction name='createPDF' access='remote' returntype='string'>
<cfargument name='input' type='string'> <cfset var documentStatus =
createPDF() /> <cfreturn documentStatus /> </cffunction> <!--- Create
PDF ---> <cffunction name='createPDF' access='remote' returntype='string'>
<cftry> <cfdocument format='flashpaper'> <p>Hello World!!!</p>
#input# </cfdocument> <cfset var result = true /> <cfcatch
type='any'> <cfset var result = false /> </cfcatch> </cftry>
<cfreturn result /> </cffunction> </cfcomponent> Also, try using a
cfinclude for just the cfdocument include in the CFC. Maybe there is a bug
there. I haven't used cfdocument before so I can't say for sure.
Hi gib sllab, thanks for the reply..
I have changed my cfc to your code below and now i am getting a new error:
MethodName: "/1/onStatus"
ResponseURI: (undefined)
Parameters (object #2)
.....code: "Server.Processing"
.....description: "Routines cannot be declared more than once."
.....details: ""
.....level: "error"
.....type: ""
.....rootcause (object #3)
..........code: (undefined)
..........description: "Routines cannot be declared more than once."
..........details: ""
..........level: "error"
..........type: ""
I dont know much about CFC's i take it this is because you have functions
called "createPDF", any ideas???
Also im not sure what ive done with the AS, i thougth this was AS2 all the
code ive seen is writen the same way i have??
thanks
Stephen
Gib Sllab - 16 Mar 2005 15:09 GMT
Ooops sorry, yeah you're using AS 2.0 syntax. So it is 2.0. However, there are
other ways of handling the remoting code. In the Flash dictionary, in the
remoting section, there is a very detailed example of how to create remoting
code with CF. It includes examples for result events and fault events. I highly
recommend you look at that when you have a chance. It's just a different way
of handling it, and I like it. I'm going to rewrite that code I gave you.
I'll try to get it right this time. One thing I notice is you're not setting
enough variables for the cfdocument tag. By default that tag is set to build a
document right into the browser. I don't think that will work with remoting the
way I suggested or with your example either. There are a couple of way you
can do this. One way would be not to even use remoting. Just have link that
goes right to your original example. EX: getURL('myCFC.cfc?method=createPDF',
'_blank'); EX #2, This would require a little expirementation since i haven't
used this document building code before: <cfcomponent> <!--- Remoting Call
---> <cffunction name='myRemoting' access='remote' returntype='boolean'
hint='I am the remoting function'> <cfset pdfStatus = createPDF() />
<cfreturn pdfStatus /> </cffunction> <!--- Create PDF ---> <cffunction
name='createPDF' access='private' returntype='any' output='true' hint='I
generate a flashpaper'> <cftry> <cfdocument format='flashpaper'
filename=''>Hello World!!!</cfdocument> <cfset result = true /> <cfcatch
type='any'> <cfset result = false /> </cfcatch> </cftry> <cfreturn
result /> </cffunction> </cfcomponent> FYI, I have written a tag or rather
a set of code that aides in document building. It's called DynamicFiles. You
can see it at www.cftags.net At some point I may roll this cfdocument code
into this. My tag kind of helps pick up where CF leaves off. MM should have
built additional file type genertation in the cfdocument tag. Such as word
docs.