ColdFusion component-flash remoting

Source: Internet
Author: User
Necessary tools

The following software is required for the instances in this article:

  1. Flash remoting component-download the flash remoting component.
  2. ColdFusion MX-a single user test can be downloaded from here.
  3. Flash MX-test version can be downloaded from here.
  4. Microsoft Access-the simple database used in the example in this article uses the. mdb Format (ACCESS). However, as long as your data table maintains the consistency between the name and field name, other types of databases can also be used (datasource Name:Flash_cf, Table Name:Sitecontent).
  5. Demo file-download the file used for the demo.

Flash remoting and ColdFusion components are integrated in five steps.

1st: Data Source

Open the ACCESS database used in this article (find from the downloaded .zip file) and log on as the ColdFusion MX administrator. The name of a table isSitecontent.SitecontentA data table consists of four fields:Pageid,Pagetitle,PagetextAndPagelink. Figure A shows the ACCESS database screen.

Figure

Access Database Screen

2nd: Install the flash remoting component

The Flash remoting Component enables interaction between flash and ColdFusion. For simple directory classification and installation instructions, refer to the instructions on the Macromedia Website.

3rd: ColdFusion component

Access and download the ColdFusion component (CFC) in the ZIP file )(Flash_cf.cfc) And read the source code. ColdFusion's new CFC has the so-called "self-document" feature, that is, they can automatically share their attributes, methods, and other information. CFC is basically a set of functions called methods. They have multiple methods rather than attributes (attributes are required for custom tags), and CFC uses parameters that have already set the application scope when calling methods.

We use CFC to query our access database and display data in flash.

First, observe CFC carefully. OpenFlash_cf.cfc, You can notice that there is a simple method calledGetpageall.GetpageallMethod contains<Cfquery>Label to select the data sourceFlash_cfSitecontent.GetpageallThe method returns the query object to the Flash MX animation through Flash remoting.

Since many CFC are packaged in different categories, they are usually stored in their own directories. So you must ensure thatFlash_cf.cfcSave the file inCFCDirectory.

4th: Flash Interface

OpenFlash_cf.fla, Four layers are found:ActionScript, Dynamic content, layout, and background (Figure B ). ClickActionScriptLayer to open the actions Panel.

Figure B

Demonstration flash Interface

Connect to flash remoting services.Program ListConnect toFlash_cf.cfcAnd expose all the methods.

Port Data through interfaces. On the Dynamic Content layer, you will find the text boxSite_title, Instancename_0 andSite_link. We useProgram list BMentioned inActionScriptFunction fill data.

Text BoxSite_linkIt will contain HTML data. This is also a method to link websites from flash. ClickSite_linkThe HTML formatting button is selected in the text box.

5th: test the application

The last step is to test the application. You should release your own Flash animation, and observe how the simple flash interface extracts data from the access data through CFC. Figure C shows the screenshot of the Flash animation.

Figure C

Demonstration of Flash Animation screenshots

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.