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デベロッパーセンター /

Introducing the MXML and ActionScript languages

by Trilemetry

Trilemetry
  • Trilemetry, Inc.

Created

22 March 2010

ページ ツール

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

タグ

必要条件

ユーザーレベル

すべて

This article is geared towards ColdFusion developers who want a high-level overview of the two programming languages in the Adobe Flex framework. You will also learn how these languages can work together to handle the system and user events that drive Flex interaction.

Understanding ActionScript classes and MXML components

The Flex framework provides two programming languages: ActionScript and MXML. ActionScript 3.0 is an ECMA-compliant scripting language similar in syntax to JavaScript and Java. MXML is an XML-based declarative language similar to CFML.

This is an example of an ActionScript function with variable declarations:

protected function addEmployee_clickHandler(event:MouseEvent):void { private var firstName:String; private var lastName:String; }

This is an example of a Button UI control declared as an MXML tag:

<s:Button id="addEmployee" label="Add Employee" click="addEmployee_clickHandler(event)" />

MXML tags are actually created with ActionScript under the hood. When you compile your Flex application, the MXML is converted into ActionScript which is then compiled into a SWF file. This means that your entire application could be written in ActionScript. However, you will primarily use MXML to define your Flex application UI and ActionScript to program your business logic.

Introducing ActionScript classes

ColdFusion developers who are not familiar with object-oriented programming (OOP) will need to establish a foundation in OOP concepts.

Note: The free Adobe Flex in a Week training series covers an introduction to object-oriented programming that is specifically designed for developers to learn OOP in the context of Flex application development.

ActionScript is an OOP language that encapsulates all of its functionality in classes. The Flex framework includes libraries of pre-built classes that provide data retrieval and handling, animation, UI elements and layout, and much more. Figure 1 shows some ActionScript 3.0 classes in a common OOP documentation format.

Some ActionScript 3.0 classes
Figure 1. Some ActionScript 3.0 classes

Introducing Flex UI components

You now know that MXML is ActionScript under the hood. That means that each MXML tag is actually an ActionScript class. Figure 2 shows a list of classes in an ActionScript library called Spark. The third class listed in the library is the Button class, which refers to the same Button MXML code that you saw earlier in this article.

Some classes in the Spark library
Figure 2. Some classes in the Spark library

The Flex framework provides two libraries of user interface components known as Spark and MX. The MX components, also known as the Halo components, were originally included in Flex 3 and each had logic in it that tightly integrated its behavior with layout and look-and-feel. The Spark components are new in Flex 4 and have been designed specifically to separate behavior, layout, styles and skins. This separation allows for better control over all aspects of the component and improved reusability.

Note: Eventually, there should be equivalent Spark components for the MX components, but in the meanwhile, you can use them together. When both a Spark and MX component exists, choose the Spark component.

For both the Spark and MX libraries, there are two categories of components: controls and containers. Controls are UI elements like TextInput, Button, DataGrid or DropDownList components. Containers hold and layout content, which could be controls or other containers. Figure 3 shows some available Flex components.

Some Flex components
Figure 3. Some Flex components

Introducing event-driven development

ColdFusion applications are built procedurally. In other words, the server processes all CFML code from top to bottom, in order. Flex applications follow an event-driven model for code processing which relies on code to run based on system or user events.

A system event is dispatched by the application and could include the application starting up, a component laid out for display or data returned from a service call. A user event is triggered when an end user interacts with the application and could include a mouse click or a keyboard input.

Consider the following code:

<fx:Script> <![CDATA[ protected function addEmployee_clickHandler(event:MouseEvent):void { private var firstName:String; private var lastName:String; } ]]> </fx:Script> <s:Button id="addEmployee" label="Add Employee" click="addEmployee_clickHandler (event)" />

I won't go into the details of all the code, but you can see that the ActionScript code is placed inside of an MXML Script block. Although the function in the Script block is place higher in the code than the Button control, it actually does not run until the user clicks on the Button control to trigger the click event and run the associated click handler function, which, in this case, is named addEmployee_clickHandler().

Where to go from here

  • This article is a high-level overview of the Flex programming languages and event-driven development. For a more thorough introduction to these topics, explore Days 1 and 2 of the Flex in a Week training series.
  • To learn about the Adobe Flash Platform and Adobe Flex and how Flex fits into the world of an Adobe ColdFusion developer, refer to the article Understanding Flex in the client/server model.
  • To learn how to create CFCs for use with Flex, refer to the article Understanding the role of CFCs in Flex application development.
  • To get started building your first Flex application with Flash Builder and ColdFusion Builder, follow the steps outlined in the 3-part tutorial Set up and build your first Flex and ColdFusion application.

More Like This

  • Building a Flex application that connects to a BlazeDS Remoting destination using Flash Builder 4.5
  • Creating components and enforcing separation of concerns with Flex
  • Creating Flex components
  • Building a Flex application that connects to a BlazeDS Remoting destination using Flash Builder 4
  • Defining and using new skin parts in a Spark skin
  • Building an icon-checkbox component with Flex 3
  • The technologies for building Flex and Java applications
  • Set up and build your first Flex and ColdFusion application – Part 1: Database setup
  • Set up and build your first Flex and ColdFusion application – Part 2: Generating ColdFusion components
  • Understanding Flex in the client/server model

製品

  • 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