Home > Store

Developing Flex 4 Components: Using ActionScript & MXML to Extend Flex and AIR Applications

Register your product to gain access to bonus material or receive a coupon.

Developing Flex 4 Components: Using ActionScript & MXML to Extend Flex and AIR Applications

eBook (Watermarked)

  • Sorry, this book is no longer in print.
  • Includes EPUB and PDF
  • About eBook Formats
  • This eBook includes the following formats, accessible from your Account page after purchase:

    ePub EPUB The open industry format known for its reflowable content and usability on supported mobile devices.

    Adobe Reader PDF The popular standard, used most often with the free Adobe® Reader® software.

    This eBook requires no passwords or activation to read. We customize your eBook by discreetly watermarking it with your name, making it uniquely yours.

Not for Sale

Description

  • Copyright 2011
  • Edition: 1st
  • eBook (Watermarked)
  • ISBN-10: 0-13-268513-2
  • ISBN-13: 978-0-13-268513-9

The Complete Insider’s Guide to Building State-of-the-Art Components with Adobe’s Flex 4 Platform

Using Adobe’s Flex 4 framework, developers can build rich, immersive solutions more easily and quickly than ever. Much of Flex 4’s remarkable power is based on its component-based approach. Adobe provides many components “out of the box,” but you can accomplish even more by building your own. In Developing Flex 4 Components, world-renowned Flex and Flash developer Mike Jones thoroughly demystifies all facets of Flex component development, showing how to quickly create and deliver high-value components to the widest possible audience.

Jones introduces the Flex 4 component architecture, reviews its built-in components, and shows how they can be extended or incorporated into new components. Next, he walks through developing components from scratch, covering issues ranging from events to skinning. Finally, he turns to distribution, introducing best practices for everything from integration to documentation.

Jones draws on nearly 15 years’ experience developing with Flex and Flash. You’ll find extensive sample code, plus dozens of practical tips that are available nowhere else. After reading this book, you'll be able to

·        Set up your Flex and Flash Builder development environment

·        Understand key differences between Flex 3 and Flex 4 component frameworks

·        Learn how Flex components are typically structured, developed, and rendered

·        Leverage ActionScript and MXML to quickly create components

·        Implement view states, transitions, effects, and events

·        Manipulate and store complex data collections

·        Use Flex 4’s FXG and MXMLG to support skinning and styling

·        Create components with Flash Professional CS5’s drawing tools

·        Integrate components with Flash Builder

·        Package components for easy distribution with or without source code

·        Streamline implementation with manifests, design view extensions, and metadata

If you’re an experienced Flash, Flex, or AIR developer, this book will help you create any component you can imagine–and deliver solutions others can only dream about.

Downloads

Source Code

Download the source code files for this eBook.

Sample Content

Table of Contents

Preface xvii

PART I: OVERVIEW AND INSTALLATION

Chapter 1  Getting Started     3

Flex     3

   What Is Flex?     4

   Flex SDK     4

Flex Development Versus Flash Authoring     5

   Flash Builder Has No Drawing Tools or Timeline     5

   Flex SWFs Are Massive    6

   Flash Builder Has No Symbol Library     6

Flash Builder     6

   What Does This Actually Mean to You?     7

   Wrapping the Flex SDK     7

   Installing Flash Builder     7

   Downloading Flash Builder     8

   Starting the Installation of Flash Builder    8

Launching Flash Builder     12

Creating Your First Project     12

Summary     16

Chapter 2  The Flex 4 Components     17

Components: A Potted History     17

Using Flex Components     19

Component Family Tree     20

   Control Components     23

   Navigator Components     31

   Layout Components     34

   Charting Components    37

   AIR-Specific Components     37

Summary     39

Chapter 3  Anatomy of a Component     41

Component Life Cycle    41

Understanding the Structure     43

   Component Constructor     44

Inherit, Composite, or Rolling Your Own     51

UIComponent     51

   Something for Nothing     52

   UIComponent for MXML     53

IMXMLObject     55

Template Components    56

   Deferring Instantiation     56

Summary     60

PART II: DEVELOPING COMPONENTS

Chapter 4  Creating Your First Component     63

MyFirstComponent    63

   Creating the Class    65

   Core Component Methods     66

   Adding Some Form     66

   Showing Yourself Off    68

   Testing It Out     69

   This Belongs to Me     70

   Sibling Rivalry     73

MyFirstComponent (Revised)     74

   Distilling MyFirstComponent (Halo)     74

   Slimming Down with MXML (Halo)     76

   Distilling MyFirstComponent Down (Spark)     80

   Weapon of Choice     82

Summary     82

Chapter 5  Managing States     83

What Are States?     83

Flex’s View States     84

Creating States in MXML    86

   Assigning States    87

   stateGroups    87

Working with States in ActionScript     90

   Overrides     91

   Creating and Destroying View States    98

Adding States to Components     101

   Worth Noting    103

Summary     103

Chapter 6  Effects and Transitions     105

Effects     105

   Effect Types     105

Working with Effects     111

   Declaring Effects     111

   Triggering Effects     111

   Orchestrating Effects     114

   Working with MotionPath and Keyframe     117

Transitions     119

Summary     123

Chapter 7  Working with Metadata     125

What Is Metadata?     125

How Do I Use Metadata?     126

Working with Metadata     128

   Exposing Information About Your Component     128

   Describing Events     131

   Exposing Styles and Effects     132

   Embedding Assets     133

   Binding Data     134

   Setting Defaults     135

   Working with Skins     137

   Excluding Component Attributes     138

   Altering and Deprecating Properties and Classes     139

   Providing an Icon     140

   And the Rest     140

Metadata in MXML     140

Creating Your Own Metadata Tags     141

   Are Metadata Tags Classes?     141

Summary     145

Chapter 8  Events and Event Handling     147

Why Events?     147

   Subscribers Versus Watchers     147

   Asynchronicity     148

   Event Flow     148

Dispatching Events     150

   Adding Event Listeners     152

Custom Events     152

   Extending the Event Class     153

   Cloning Events     154

   Dealing with Event Priority     155

   Event Priority Constants     155

Countering Events     156

   Event Propagation     157

   Prevent Defaults     158

Summary     159

Chapter 9  Manipulating Data     161

Defining Component Data     161

Data Providers     161

   KISS     162

Managing Data     163

   Collections     165

Displaying Data     177

   Data Renderers     177

   Rendering the UI     178

   Linking itemRenders to External Data     178

Summary     185

Chapter 10  Skinning and Styling     187

Spark Versus Halo     187

Spark Skin Life Cycle     187

Where Do I Start?     189

Working with SkinnableComponent     189

   partAdded(), partRemoved()     189

   getCurrentSkinState()     192

Creating Component Skins     193

FXG and MXMLG     194

   Creating a Component Skin     194

   Drawing Nonlinear Content     198

Spark Skins and Halo Components     200

Working with Properties and Styles     202

Using CSS     202

   Custom Namespaces     202

   Descendant Selectors     203

   ID Selectors     204

   Pseudo Selectors     204

Summary     205

Chapter 11  Creating Flex Components with Flash Professional CS5     207

Picking a Starting Point     207

   Starting with Flash Professional     207

   Starting with Flash Builder 4     209

Implementing States     212

Implementing Transitions     213

Controlling Component Resizing     215

   Bounding Boxes     216

   External Manipulation     216

Creating Component Visual Assets     218

   Putting It All Together     219

   Adding the Transition Animations     220

Properties and Methods     220

Metadata     221

Events     222

Externalizing Component Classes     223

Container Components     226

Summary     227

PART III: DISTRIBUTION

Chapter 12  The Flex Library Project     231

Packaging Your Component     231

SWC Format     231

   library.swf     232

   catalog.xml     232

   Locale     233

   Assets     234

Working with the Flex Library Project     234

   Creating a Flex Library Project     234

   What If It All Goes Wrong     242

compc     242

Summary     243

Chapter 13  Component Integration in Flash Builder 4     245

Why Integrate with Flash Builder?     245

What Can I Integrate With?     246

   Panel Integration     246

   Design View Extensions     253

Live Previews     261

Setting Default Styles     262

Summary     263

Chapter 14  Documentation     265

Why Should I Document Code?     265

   Last to the Party, First to Leave     265

   Documentation Is Boring     266

   My Code Is Easy to Read     266

   OK I Get It, Enough Already     266

Commenting Your Code     266

   Basic Comment Types     267

   ASDoc Comment Blocks     267

   ASDoc Tags     268

   HTML Formatting     272

   Special Characters     273

   Metadata Comments     274

   Documenting MXML     274

   Bypassing Documentation     275

Generating Your Documentation     276

   Command-Line Document Generation     276

   Generating Documentation in Flash Builder     277

   Getting to Grips with Ant     281

Summary     288

Appendix A  Flex Resources     291

Blogs     291

   Adobe Blogs     291

   Independent Blogs     292

   Resource Sites     292

Frameworks     293

Useful Tools and Extensions     293

   Adobe Tools     294

   Third-Party Tools     294

Logwatcher     294

   Regular Expression Tools     294

Index     295

Updates

Submit Errata

More Information

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020