all groups > flash actionscript > february 2004 >
You're in the

flash actionscript

group:

CFC returned value to Flash



CFC returned value to Flash developer2be
2/6/2004 7:18:40 PM
flash actionscript: I have a CFC that returns a String Value back to Flash. I would like to use a Message Box to display the returned valued from CFC.

In other words, after inserting a record into DB, I would like to display "Record Inserted Successfully!".

How do I accomplish this in ActionScript?

<!--- insert users informatin into database --->
<cffunction access="remote" name="insertUser" returntype="string" hint="Insert user profile/information into the database">
<cfargument name="bemsid" required="true" type="numeric">
<cfargument name="displayname" required="true" type="string">
<cfargument name="lastname" required="true" type="string">
<cfargument name="firstname" required="true" type="string">
<cfargument name="email" required="true" type="string">
<cfargument name="userRole" required="true" type="string">
<cfargument name="userAccess" required="true" type="string">
<cfargument name="disableAcct" required="true" type="string">
<cfargument name="USPerson" required="true" type="string">

<cfquery datasource="ttswt_users">
INSERT INTO tblUsers (bemsid, displayName, lastname, firstname, email, userRole, userAccess, disableAcct, userPerson)
VALUES (#bemsid#,'#displayName#','#lastname#','#firstname#','#email#','#userRole#','#userAccess#','#disableAcct#','#USPerson#')
</cfquery>

<cfreturn "New Profile Inserted Successfully!">
</cffunction>


Re: CFC returned value to Flash P.R. Newman
2/7/2004 12:13:34 AM
[quoted text, click to view]
(#bemsid#,'#displayName#','#lastname#','#firstname#','#email#','#userRole#',
'#userAccess#','#disableAcct#','#USPerson#')
[quoted text, click to view]

I usually wrap the <cfquery> tag inside <cftry> tags. If the database insert
occurs without an error, I return true. If an error occurs, I return false.

Then, in the onResult method in the ActionScript, I open a dialog box and
display the appropriate message to the user.

--
Paul
-------------------------
Team Macromedia Member for Central
http://www.macromedia.com/go/team/
Extending Knowledge, Daily
http://www.communitymx.com
-------------------------

AddThis Social Bookmark Button