The created step is as follows: Use dwmx (the abbreviation of Dreamweaver MX, the same below), File → New: Create a new document dialog box, general card, dynamic page, and select the ColdFusion component. [As shown in the figure]
Open the Component panel [Window → Component] Click + Create a new component As shown in the figure: The "Name" box specifies the .cfc file name. Do not specify the .cfc file extension when entering a name. The Component Directory box specifies where the component will be saved. Add two functions to the component: Access method is set to If you select Remote from the Access menu, the function can be used as a web service. Make sure to specify the appropriate type of value returned by the function in the Return Value Type box. Add parameters to define one or more parameters for the function. Select Parameters from the Partial list, select the function from the pop-up menu, click the plus sign (+) button, and enter the details of the new parameter on the right. [Add three parameters to this function, all of which are strings]
Add body to the function: Window/binding Click + to select the record set (query) in the list Add a record set Recordset1 Enter the following query code:
SELECT , , , ,
FROM tblEmployees, tblDepartments
WHERE =
<cfif isDefined("ming")>
and like '#ming#%'
</cfif>
<cfif isDefined("xing")>
and like '#xing#%'
</cfif>
<cfif isDefined("cheng")>
and like '#cheng#%'
</cfif>
ORDER BY ,
Add Recordset2 in the same way
Switch the document to the code view, cut Recordset1[<cfquery >...</cfquery >] to the <!---- chaxun1 body ---> and paste it with the same method Recordset2 to query 2. Then set <cfreturn> Query 1 to <cfreturn Recordset1>
Query 2 Set to <cfreturn Recordset2>
File/Save file. Close dwmx and start flashmx.
2. Create flash video.
1 File → Create a new flash video. Create a new layer, named script, and layer one is named ui.
Select Components Flash MX UI Components Host several components into the document, and the settings are as shown in the figure:
Code copy box
The following is a quoted snippet: #include "" #include "" #include "" if (inited == null) { // Execute code only once inited = true; // Set the default gateway url ("http://localhost:8500/flashservices/gateway"); // Connect to the gateway gateway_conn = (); // Return a reference to a service myService = gateway_conn.getService("", this); } function query () {trace(engineer.getSelectedItem().label); trace(name.text); trace(last name.text); myService.chaxun1(first.text, last name.text, project.getSelectedItem().label); } function chaxun1_Result(result){ (Show box, result, "#LastName#, #FirstName#, #DepartmentName#", "#EmployeeIDFK#"); } function chaxun2_Result(result ){ (Project, result, "#DepartmentName#", "#DepartmentID"); } myService.chaxun2(); |
The results of the run are as follows: