Adobe
Products
Acrobat
Creative Cloud
Creative Suite
Digital Marketing Suite
Digital Publishing Suite
Elements
Photoshop
Touch Apps
Student and Teacher Editions
More products
Solutions
Creative tools for business
Digital marketing
Digital media
Education
Financial services
Government
Web Experience Management
More solutions
Learning Help Downloads Company
Buy
Home use for personal and home office
Education for students, educators, and staff
Business for small and medium businesses
Licensing programs for businesses, schools, and government
Special offers
Search
 
Info Sign in
Welcome,
My cart
My orders My Adobe
My Adobe
My orders
My information
My preferences
My products and services
Sign out
Why sign in? Sign in to manage your account and access trial downloads, product extensions, community areas, and more.
Adobe
Products Sections Buy   Search  
Solutions Company
Help Learning
Sign in Sign out My orders My Adobe
Preorder Estimated Availability Date. Your credit card will not be charged until the product is shipped. Estimated availability date is subject to change. Preorder Estimated Availability Date. Your credit card will not be charged until the product is ready to download. Estimated availability date is subject to change.
Qty:
Purchase requires verification of academic eligibility
Subtotal
Review and Checkout
Adobe Developer Connection / Flex Developer Center /

Exercise 1.3: Generating an email address using data binding

by Trilemetry

Trilemetry
  • Trilemetry, Inc.

Content

  • Implementing data binding

Modified

2 May 2011

Page tools

Share on Facebook
Share on Twitter
Share on LinkedIn
Bookmark
Print
Flash Builder Flex RIA

Requirements

Prerequisite knowledge

  • Exercise 1.1: Setting up your project files

User level

Beginning

Required products

  • Flash Builder 4.5 Premium (Download trial)

Exercise files

  • ex1_03_starter.zip
  • ex1_03_solution.zip

In this exercise you will learn how to customize Flex components and bind them to data to create an auto-generating email address (see Figure 1).

Review your task for this exercise.
Figure 1. Review your task for this exercise.

In this exercise you will learn how to:

  • Implement data binding

Implementing data binding

In this section you will use data binding to populate the employee email address based on the employee's first and last name.

  1. Download the ex1_03_starter.zip file if you haven't already and extract the file ex1_03_starter.fxp to your computer.
  2. Open Flash Builder.
  3. Import the ex1_03_starter.fxp file.
  4. Open the ex1_03_starter.mxml file.
  5. Locate the FormItem container with the label property First Name:.
  6. To the nested TextInput control, add the id property firstName:
<s:FormItem label="First Name:"> <s:TextInput id="firstName" width="196"/> </s:FormItem>
  1. Locate the FormItem control with the label property lastName:.
  2. To the nested TextInput control, add the id property lastName:.
<s:FormItem label="Last Name:"> <s:TextInput id="lastName" width="196"/> </s:FormItem>
  1. Locate the FormItem control with the label property assigned to Email:.
  2. To the nested TextInput control, bind the value of the text property to the value of the firstName and the lastName text properties, separating the values with a period. Append @xyzcompany.com to the end of the text property value so that a full email address is displayed.
<s:FormItem label="Email:"> <s:TextInput text="{firstName.text}.{lastName.text}@xyzcompany.com" width="196"/> </s:FormItem>
  1. Save the file.
  2. Run the application.
  3. Enter Athena into the First Name input field.
  4. Enter Parker into the Last Name input field.

    You should see the Email field populate with an email address based on the firstName and lastName TextInput controls (see Figure 2).

Use the first and last name fields to create an employee email address.
Figure 2. Use the first and last name fields to create an employee email address.
  1. Change the First Name field to read Athena Sara.

    Note that the email address is created with a space in it (see Figure 3).

 Edit the employee's first name.
Figure 3. Edit the employee's first name.
  1. In the Email field, remove the space from between the two first names.

    You should see that editing the email address does not affect the first and last name values (see Figure 4). This is an example of one-way binding.

Changing the email address does not result in changes to other fields.
Figure 4. Changing the email address does not result in changes to other fields.

In this exercise you learned how to create and reuse a Flex custom component and bind data. In the next exercise you will use an XML file to populate the Employee Portal: Vehicle Request Form with dynamic data.

Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License+Adobe Commercial Rights

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License. Permissions beyond the scope of this license, pertaining to the examples of code included within this work are available at Adobe.

More Like This

  • Exercise 1.6: Creating MXML custom components with ActionScript properties
  • Exercise 1.5: Experimenting with container layouts
  • Exercise 5.2: Defining selector styles
  • Exercise 1.1: Setting up your project files
  • Exercise 1.2: Creating an application user interface
  • Exercise 1.4: Adding data to your application
  • Exercise 4.7: Creating and navigating application states
  • Exercise 3.4: Passing data to the server with the HTTPService class
  • Exercise 3.4: Passing data to the server with the WebService class
  • Exercise 4.8: Creating a scalable user interface

Products

  • Acrobat
  • Creative Cloud
  • Creative Suite
  • Digital Marketing Suite
  • Digital Publishing Suite
  • Elements
  • Mobile Apps
  • Photoshop
  • Touch Apps
  • Student and Teacher Editions

Solutions

  • Digital marketing
  • Digital media
  • Web Experience Management

Industries

  • Education
  • Financial services
  • Government

Help

  • Product help centers
  • Orders and returns
  • Downloading and installing
  • My Adobe

Learning

  • Adobe Developer Connection
  • Adobe TV
  • Training and certification
  • Forums
  • Design Center

Ways to buy

  • For personal and home office
  • For students, educators, and staff
  • For small and medium businesses
  • For businesses, schools, and government
  • Special offers

Downloads

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

Company

  • News room
  • Partner programs
  • Corporate social responsibility
  • Career opportunities
  • Investor Relations
  • Events
  • Legal
  • Security
  • Contact Adobe
Choose your region United States (Change)
Choose your region Close

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.

Terms of Use | Privacy Policy and Cookies (Updated)

Ad Choices

Reviewed by TRUSTe: site privacy statement