Adobe
製品
Acrobat
Creative Cloud
Creative Suite
Digital Marketing Suite
Digital Publishing Suite
Elements
Photoshop
Touch Apps
その他の製品一覧
ソリューション
デジタルマーケティング
デジタルメディア
教育
金融機関
Web Experience Management
その他のソリューション
ラーニング サポート ダウンロード 会社情報
ご購入
アドビストア 安心のサポート& サービス
アカデミックストア 学生、教職員、個人向け
アドビライセンスストア 中小企業向け
ボリュームライセンスについて 企業、教育機関、官公庁向け
販売パートナー
キャンペーン情報
検索
 
情報 サインイン
ようこそ、 さん カート 注文状況 マイアカウント
マイアカウント
注文状況
アカウント情報の変更
コミュニケーションの設定を変更
サインアウト
サインインの目的 お客様のアカウントや体験版ダウンロード、製品の拡張機能、コミュニティエリアへのアクセスなどを管理するため
Adobe
製品 セクション ご購入   検索  
ソリューション 会社情報
サポート ラーニング
サインイン サインアウト 注文状況 マイアカウント
先行予約の提供開始予定日Date. 商品が発送されるまで、クレジットカードには課金されません。提供開始の予定日は変更される場合があります。 先行予約の提供開始予定日Date. ダウンロードの準備が整うまで、クレジットカードには課金されません。提供開始の予定日は変更される場合があります。
個数:
ご購入には学生・教職員個人版の購入資格の確認が必要です。
小計
カートの中身を見る
Adobe Developer Connection / Flexデベロッパーセンター /

Set up and build your first Flex and ColdFusion application – Part 3: Use ColdFusion and Flash Builder 4 to create an application

by Trilemetry

Trilemetry
  • Trilemetry, Inc.

Content

  • Create a Flash Builder project
  • Connect to the ColdFusion server
  • Introspect and import a CFC
  • Create a simple employee data display

Created

22 March 2010

ページ ツール

Facebookでシェア
Twitterでツイート
LinkedInでシェア
ブックマーク
印刷

タグ

必要条件

この記事に必要な予備知識

This tutorial is intended for:

  • Developers who are exploring tutorials in the Flex and ColdFusion mini learning center that are based on the Fictitious Sales Planner example.
  • Experienced ColdFusion developers without previous Adobe Flex framework or Adobe Flash Builder 4 experience.
  • ColdFusion developers who are familiar with ColdFusion components.

ユーザーレベル

すべて

必要な製品

  • ColdFusion (Download trial)
  • Flash Builder (Download trial)

サンプルファイル

  • f4cf_fictitious_db.zip (75 KB)
  • f4cf_generated_cfcs.zip (4 KB)

In Part 1, you learned how to set up a ColdFusion data source and Flash Builder project. In Part 2, which is optional, you generated the ColdFusion components (CFCs) using ColdFusion Builder. In this section, you will set up a Flash Builder data service project with ColdFusion for use with the Fictitious Sales Planner sample application.

Create a Flash Builder project

A Flash Builder project is similar to a Dreamweaver site. You create a project to store and organize your code files. Follow these steps to create a Flash Builder project:

  1. Open Flash Builder 4.

    Note: We assume that you are working with the standalone (not the plug-in) version of Flash Builder 4. You can install the plug-in version if you are already using Eclipse for your programming environment. However, you will likely see some minor variations in the following steps. We also assume that you have a local, standalone installation of ColdFusion. You may need to make changes to the paths based on your custom installation.

  2. Select File > New > Flex Project as shown in Figure 1.
Create a new Flash Builder project.
Figure 1. Create a new Flash Builder project.

You will get the new project dialog box. Set up your new project as shown in Figure 2:

  • Name the project F4CF_Importing_CFC.
  • Be sure to use the default location for this example.

In the Server technology section of the dialog box, select ColdFusion from the Application server type drop-down menu. (Note that the Use remote object access service check box is selected by default when you select a server technology.)

  • Select the ColdFusion Flash Remoting option.
Set up your new project in the New Flex Project dialog box.
Figure 2. Set up your new project in the New Flex Project dialog box.
  1. Click Next.

Connect to the ColdFusion server

Follow these steps to configure your Flash Builder project to work with your ColdFusion server:

  1. In the Configure ColdFusion Server dialog box, select the options for your ColdFusion installation type.

    Figure 3 shows the settings if you are using the default installation of ColdFusion in Standalone mode on a PC.

Specify your ColdFusion server configuration.
Figure 3. Specify your ColdFusion server configuration.

Note: If you have used the default installation of ColdFusion in Standalone mode for a Mac OS X computer, your ColdFusion settings will likely be:

  • ColdFusion root folder: /Applications/ColdFusion9
  • Built-in ColdFusion web server web root: /Applications/ColdFusion9/wwwroot
  • Built-in ColdFusion web server root URL: http://localhost:8500
  1. Click the Validate Configuration button to ensure that the settings are correct.

    Note that the location of the Output folder is located within the ColdFusion server web root.

    Flash Builder automatically creates a folder named based on the project name and appended with –debug.

    In this case, the F4CF_Importing_CFC-debug folder is where Flash Builder will place the compiled Flash SWF and HTML wrapper files.

    Note: If you have the default installation of ColdFusion in Standalone mode for a Mac OS X computer, your Output folder setting is likely /Applications/ColdFusion9/wwwroot/F4CF_Importing_CFC-debug.

    Remember that Flash source files, unlike ColdFusion source files, are not deployed to the web server.

    Instead, you compile the source into a SWF file that is referenced in HTML wrapper files. The SWF and HTML files are uploaded to the server.

  2. Click Finish to create the Flash Builder project.

You will see the F4CF_Importing_CFC project in the Package Explorer, shown in Figure 4. Note also that the MXML application file with the same name is created and opened for editing. Note that Figure 4 shows the MXML Editor tab in Design mode. Click the Source button below the tab to see the Editor in code view.

The Flash Builder project in the Package Explorer
Figure 4. The Flash Builder project in the Package Explorer

The Flex framework provides two programming languages: ActionScript, which is a fully object-oriented language, and MXML, which is an XML-based language with similar syntax to CFML.

Introspect and import a CFC

Introspect and import a CFC

Now that your database, data source, and Flash Builder project are set up, you are ready to learn how easy it is to retrieve data from a CFC method and bind it to a Flex user interface element. Time to complete: 5 minutes.

Downloading the ColdFusion component

ColdFusion components are a way of organizing your business logic into reusable code. They were introduced in ColdFusion MX and replace the inline database query construct. In other words, instead of putting a cfquery tag at the top of your CFML page, you invoke the query that is placed into a CFC method, passing in arguments as necessary.

Note: Refer to the article Understanding the role of CFCs in Flex application development for more information on CFCs.

Note: If you generated the CFC's using ColdFusion Builder, then skip to Using the Data Services wizard to import a CFC section. Otherwise, continue with the following steps to download the CFC’s needed to continue with this exercise.

  1. Download and unzip the provided f4cf_ generated_cfcs.zip file on your local disk if you haven’t done so already.
  2. Move the F4CF_FictitiousSalesPlanner folder to the \\wwwroot directory.

Using the Data Services wizard to import a CFC

Next, you will import the CFC into the project using the Data/Services view in Flash Builder:

  1. Locate the Data/Services view in Flash Builder shown in Figure 5.

    (If the view is not open, select Window > Data/Services.)

The Data/Services view.
Figure 5. The Data/Services view.
  1. Click the Connect to Data/Service link to run the Data Services wizard.

    Note: You can also select Data > Connect to Data/Service to open the Data Services wizard.

  2. Select ColdFusion for the service type (see Figure 6).
Select the ColdFusion data service type.
Figure 6. Select the ColdFusion data service type.
  1. Click Next.
  2. For CFC Location, browse to C:\ColdFusion9\wwwroot\F4CF_FictitiousSalesPlanner\SALESTARGETSService.cfc and Click Open. See Figure 7.
Configure the ColdFusion Service.
Figure 7. Configure the ColdFusion Service.
  1. Click Next.
  2. In the Remote Service Authentication dialog box, shown in Figure 8, enter your RDS username and password.

Note: Be sure to have RDS enabled in the ColdFusion Administrator. Remember that the default username is admin.

Enter your credentials to authenticate RDS access.
Figure 8. Enter your credentials to authenticate RDS access.
  1. Click OK.

    Flash Builder accesses the CFC, introspects it, and returns information about the available operations and data types associated with those operations. You will see each method in the CFC displayed in the Service Operations window shown in Figure 9.

The Service Operations dialog displays the CFC methods.
Figure 9. The Service Operations dialog displays the CFC methods.
  1. Click Finish.

Flash Builder creates the service. You may see the instructions shown in Figure 10, if you have not previously selected the check box in the lower left corner of the Using Remote Services dialog box.

Instructions for using the remote service.
Figure 10. Instructions for using the remote service.

The rest of this tutorial steps you through these instructions.

  • Click OK to dismiss the Using Remote Services dialog box.
  • Locate the Data/Services view to see the CFC operations shown in Figure 11.
The introspected CFC operations.
Figure 11. The introspected CFC operations.

Note that the getAllSALESTARGETS() method name is followed by SALESTARGETS[]. When Flash Builder introspected  the CFC and provided information about the methods, it mapped the ColdFusion query that is returned from this operation to an Array data type.                    

Create a simple employee data display

Now that the CFC has been introspected into Flash Builder and the Flash Builder project is set up, you will use the returned data to create a simple employee data display. Time to complete: 5 minutes.

Reviewing the data types

In this section, you will review the SALESTARGETS Data Type within the Data Services view.

Expand the Data Types category in the Data/Services view to see that the SALESTARGETS data type is defined as an object that includes EMAIL, FIRSTNAME, and LASTNAME properties (see Figure 12).

The SALESTARGETS data type.
Figure 12. The SALESTARGETS data type.

Binding data to a Flex component

This section demonstrates how to bind the SALESTARGETS data type to a DataGrid component:

  1. Switch to Design mode in Flash Builder by clicking the Design button below the Editor tab (see Figure 13).
The Design view button.
Figure 13. The Design view button.
  1. Locate the DataGrid control of the Components view (see Figure 14).
The Flex Builder Components panel.
Figure 14. The Flex Builder Components panel.
  1. Drag and drop the DataGrid component into the Design view of the F4CF_Importing_CFC.mxml file as shown in Figure 15.
Add the DataGrid control to your application.
Figure 15. Add the DataGrid control to your application.
  1. Drag and drop the getAllSalesTargets() CFC function from the Data/Services view onto the DataGrid control to populate it with the SALESTARGETS data type.

    Leave the defaults in the Bind to Data dialog window and Click OK.

    The DataGrid control now has columns that match the properties in the SALESTARGETS data type. (see Figure 16)

The bound DataGrid control.
Figure 16. The bound DataGrid control.
  1. Select File > Save to save the MXML file.
  2. Click the Run (green round) button to test the file (see Figure 17).
Click the Run button.
Figure 17. Click the Run button.

Figure 18 shows the DataGrid control populated with the CFC data. Note that Flash Builder has opened the HTML wrapper file from the F4CF_Importing_CFC folder in the web root.

The DataGrid component populated by the SALESTARGETS data type.
Figure 18. The DataGrid component populated by the SALESTARGETS data type.

Where to go from here

In this tutorial, you set up the an Apache Derby sample database, and a ColdFusion data source. If you chose to, you generated a CFC using ColdFusion Builder. Then you set up a Flash Builder project to work with ColdFusion server technology. Finally, you experienced how easy it is to retrieve data from a CFC method and bind it to a Flex user interface element. To learn more how to build ColdFusion and Flex applications, visit the Flex and ColdFusion page in Flex Developer Center.

More Like This

  • Flash Builder 4によるデータ中心型開発
  • Adobe Flash Builder 4ベータ版によるColdFusionフォームの生成
  • Set up and build your first Flex and ColdFusion application – Part 1: Database setup
  • Flexアプリケーションの開発におけるCFCの役割について
  • Working with Doctrine 2, Zend AMF, Flex, and Flash Builder
  • Adobe Flash Builder 4ベータ版によるColdFusionデータの管理
  • Building a Flex application that connects to a BlazeDS Remoting destination using Flash Builder 4.5
  • ColdFusionおよびFlash Builder 4ベータ版入門
  • Set up and build your first Flex and ColdFusion application – Part 2: Generating ColdFusion components
  • Introducing the MXML and ActionScript languages

製品

  • Acrobat
  • Creative Cloud
  • Creative Suite
  • Digital Marketing Suite
  • Digital Publishing Suite
  • Elements
  • モバイルアプリ
  • Photoshop
  • Touch Apps

ソリューション

  • デジタルマーケティング
  • コンテンツオーサリング
  • Web Experience Management

業種別ソリューション

  • 教育
  • 金融機関

サポート

  • ヘルプ&サポート
  • 注文と返品
  • ダウンロードに関するヘルプ
  • ユーザー登録に関するヘルプ

ラーニング

  • ADC: Adobe Developer Center
  • Adobe TV
  • Design Magazine
  • Photoshop Magazine
  • Focus In

ご購入方法

  • アドビストア
  • アカデミックストア
  • アドビライセンスストア
  • ボリュームライセンスについて
  • 販売パートナー
  • キャンペーン情報

ダウンロード

  • Adobe Reader
  • Adobe Flash Player
  • Adobe AIR
  • Adobe Shockwave Player

会社情報

  • プレスルーム
  • パートナープログラム
  • 企業の社会的責任(英語)
  • 採用情報
  • 投資家の皆様へ(英語)
  • イベント&セミナー
  • Legal(英語)
  • セキュリティ
  • お問い合わせ
国・地域および言語の選択 日本(変更)
国・地域および言語の選択 閉じる

North America

Europe, Middle East and Africa

Asia Pacific

  • Canada - English
  • Canada - Français
  • Latinoamérica
  • México
  • United States

South America

  • Brasil
  • Africa - English
  • Österreich - Deutsch
  • Belgium - English
  • Belgique - Français
  • België - Nederlands
  • България
  • Hrvatska
  • Česká republika
  • Danmark
  • Eastern Europe - English
  • Eesti
  • Suomi
  • France
  • Deutschland
  • Magyarország
  • Ireland
  • Israel - English
  • ישראל - עברית
  • Italia
  • Latvija
  • Lietuva
  • Luxembourg - Deutsch
  • Luxembourg - English
  • Luxembourg - Français
  • الشرق الأوسط وشمال أفريقيا - اللغة العربية
  • Middle East and North Africa - English
  • Moyen-Orient et Afrique du Nord - Français
  • Nederland
  • Norge
  • Polska
  • Portugal
  • România
  • Россия
  • Srbija
  • Slovensko
  • Slovenija
  • España
  • Sverige
  • Schweiz - Deutsch
  • Suisse - Français
  • Svizzera - Italiano
  • Türkiye
  • Україна
  • United Kingdom
  • Australia
  • 中国
  • 中國香港特別行政區
  • Hong Kong S.A.R. of China
  • India - English
  • 日本
  • 한국
  • New Zealand
  • 台灣

Southeast Asia

  • Includes Indonesia, Malaysia, Philippines, Singapore, Thailand, and Vietnam - English

Copyright © 2012 Adobe Systems Incorporated. All rights reserved.

利用条件 | プライバシーポリシーとCookie (更新)

Reviewed by TRUSTe: site privacy statement