.3 Learning the Fundamentals of Flex ...4 Getting to know Flex applications ...4 Flex versus Flash development ...8 Flex and object-oriented programming ...11 Understanding Adobe Flash P
Trang 1basics and Flash Builder 4’s new development tools
From there, learn how to use Flex 4’s new Spark ponent skinning capability, deploy desktop apps with AIR, model and manage data, integrate your app with
com-popular application servers, and much more!
• Understand the differences between Flex and Flash development
• Master Flex 4 and Flash Builder 4 fundamentals
• Create and use custom MXML components in a Flex application
• Work with text, Cascading Style Sheets (CSS), and layout containers
• Integrate your Flex apps with BlazeDS, Java®, ColdFusion®, and PHP
• Create cross-operating system desktop applications with AIR
Companion Web Site
Access code files for all projects inthe book, as well as additional
information, useful links, and more from www.wiley.com/go/flex4
contributor to Adobe Systems’
Certified Courseware for Flex
Trang 34 Bible
Trang 54 Bible
David Gassner
Trang 610475 Crosspoint Boulevard Indianapolis, IN 46256 www.wiley.com Copyright © 2010 by Wiley Publishing, Inc., Indianapolis, Indiana Published by Wiley Publishing, Inc., Indianapolis, Indiana Published simultaneously in Canada
ISBN: 978-0-470-48895-9 Manufactured in the United States of America
10 9 8 7 6 5 4 3 2 1
No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108 of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization through payment of the appropriate per-copy fee to the Copyright Clearance Center, 222 Rosewood Drive, Danvers, MA
01923, (978) 750-8400, fax (978) 646-8600 Requests to the Publisher for permission should be addressed to the Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, 201-748-6011, fax 201-748-
6008, or online at http://www.wiley.com/go/permissions.
LIMIT OF LIABILITY/DISCLAIMER OF WARRANTY: THE PUBLISHER AND THE AUTHOR MAKE NO REPRESENTATIONS OR WARRANTIES WITH RESPECT TO THE ACCURACY OR COMPLETENESS OF THE CONTENTS OF THIS WORK AND SPECIFICALLY DISCLAIM ALL WARRANTIES, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE NO WARRANTY MAY BE CREATED
OR EXTENDED BY SALES OR PROMOTIONAL MATERIALS THE ADVICE AND STRATEGIES CONTAINED HEREIN MAY NOT BE SUITABLE FOR EVERY SITUATION THIS WORK IS SOLD WITH THE UNDERSTANDING THAT THE PUBLISHER IS NOT ENGAGED IN RENDERING LEGAL, ACCOUNTING, OR OTHER PROFESSIONAL SERVICES IF PROFESSIONAL ASSISTANCE IS REQUIRED, THE SERVICES OF A COMPETENT PROFESSIONAL PERSON SHOULD BE SOUGHT NEITHER THE PUBLISHER NOR THE AUTHOR SHALL BE LIABLE FOR DAMAGES ARISING HEREFROM THE FACT THAT AN ORGANIZATION OR WEBSITE IS REFERRED TO IN THIS WORK AS A CITATION AND/OR A POTENTIAL SOURCE OF FURTHER INFORMATION DOES NOT MEAN THAT THE AUTHOR OR THE PUBLISHER ENDORSES THE INFORMATION THE ORGANIZATION OR WEBSITE MAY PROVIDE OR RECOMMENDATIONS IT MAY MAKE FURTHER, READERS SHOULD BE AWARE THAT INTERNET WEBSITES LISTED IN THIS WORK MAY HAVE CHANGED OR DISAPPEARED BETWEEN WHEN THIS WORK WAS WRITTEN AND WHEN IT IS READ.
For general information on our other products and services or to obtain technical support, please contact our Customer Care Department within the U.S at (877) 762-2974, outside the U.S at (317) 572-3993 or fax (317) 572-4002.
Library of Congress Control Number: 2010922565 Trademarks: Wiley and the Wiley logo are trademarks or registered trademarks of John Wiley & Sons, Inc and/or its
affiliates, in the United States and other countries, and may not be used without written permission Flash, Builder, and Flex are trademarks or registered trademarks of Adobe Systems, Inc All other trademarks are the property of their respective owners Wiley Publishing, Inc is not associated with any product or vendor mentioned in this book.
Wiley also publishes its books in a variety of electronic formats Some content that appears in print may not be available in electronic books.
Trang 7About the Author
David Gassner is president of Bardo Technical Services, an Adobe training partner in Seattle,
Washington, and serves as Content Manager for Developer Titles for lynda.com As an author for lynda.com, he has recorded video training titles on Flex, AIR, ColdFusion, Dreamweaver, and ASP
NET He holds Adobe developer and instructor certifications in Flex, ColdFusion, Flash, and Dreamweaver, is an Adobe Master Instructor, and has been a regular speaker at Allaire, Macromedia, and Adobe conferences
David earned a BA from Pitzer College in Claremont, California (his home town), and an MFA from the Professional Theatre Training Program at U.C San Diego In his copious free time (and putting his MFA to good use), he is an active director and actor in Seattle’s live theater scene He shares his home with his wonderful wife, Jackie (Go Mets!), and he receives occasional visits from his thoroughly adult kids, Thad, Jason, and Jenny
Trang 8Senior Acquisitions Editor
Quality Control Technicians
Laura AlbertJohn GreenoughMelanie HoffmanLindsay LittrellLauren Mandelbaum
Proofreading
Christine Sabooni
Indexing
BIM Indexing & Proofreading Services
Media Development Project Manager
Trang 9Part I: Flex Fundamentals 1
Chapter 1: About Flex 4 3
Chapter 2: Using Flash Builder 4 31
Chapter 3: Building a Basic Flex Application 73
Chapter 4: Understanding the Anatomy of a Flex Application 99
Chapter 5: Using Bindings and Components 135
Chapter 6: Debugging Flex Applications 167
Chapter 7: Working with Events 207
Part II: Designing Flex Applications 247
Chapter 8: Using Flex Visual Controls 249
Chapter 9: Working with Text 287
Chapter 10: Using Layout Containers 311
Chapter 11: Using Cascading Style Sheets 341
Chapter 12: Controlling Animation and Working with Drag and Drop 371
Chapter 13: Managing View States 399
Chapter 14: Declaring Graphics with MXML and FXG 419
Chapter 15: Skinning Spark Components 443
Chapter 16: Managing Application Navigation 469
Chapter 17: Working with Pop-up Windows 503
Part III: Working with Data 531
Chapter 18: Modeling and Managing Data 533
Chapter 19: Using List Controls 571
Chapter 20: Using Advanced List Controls 603
Chapter 21: Using the Flex Charting Controls 647
Chapter 22: Working with Data Entry Forms 675
Chapter 23: Working with HTTPService and XML 707
Chapter 24: Managing XML with E4X 749
Trang 10Chapter 26: Integrating Flex Applications with BlazeDS and Java 807
Chapter 27: Using the Message Service with BlazeDS 849
Chapter 28: Integrating Flex Applications with ColdFusion 873
Chapter 29: Integrating Flex Applications with PHP 911
Part V: Additional Subjects 939
Chapter 30: Localizing Flex 4 Applications 941
Chapter 31: Deploying Desktop Applications with Adobe AIR 955
Index 983
Trang 11Part I: Flex Fundamentals 1
Chapter 1: About Flex 4 . . . .3
Learning the Fundamentals of Flex 4
Getting to know Flex applications 4
Flex versus Flash development 8
Flex and object-oriented programming 11
Understanding Adobe Flash Player 18
Learning a little Adobe Flash Player history 19
Understanding Flash Player penetration statistics 21
Using the debug version of Flash Player 21
Flash Player installation 22
Flex 4 Development Tools 26
Understanding Flash Builder 4 26
Using the Flex 4 SDK 26
Getting Help 29
Summary 29
Chapter 2: Using Flash Builder 4 . . 31
Getting Flash Builder 31
Installing Flash Builder 4 32
Installing Flash Builder with the stand-alone configuration 32
Getting to Know Eclipse Features 36
The Eclipse workspace 37
Configuring Eclipse 43
Using Flash Builder 45
Creating a Flex project 45
Understanding Flash Builder’s user interface 49
Getting Help 55
Exploring the Help contents 55
Searching for Help terms 56
Using dynamic help 57
Trang 12Searching for Code 58
Using Eclipse search tools 58
Using Flash Builder code model search tools 60
Generating Code 64
Generating getter and setter methods 64
Generating event handlers 66
Integrating Flash Builder with Flash Professional CS5 66
Summary 71
Chapter 3: Building a Basic Flex Application . . 73
Creating a “Hello World” Application 74
Switching workspaces 74
Creating the project 75
Saying hello 78
Understanding the html-template Folder 81
The HTML wrapper template 82
History management files 87
Deploying the Application 88
Creating a release build 88
Testing the release build 90
Deploying the release build 91
Integrating an application into an existing Web page 91
Integrating Flex applications with Dreamweaver 93
Summary 97
Chapter 4: Understanding the Anatomy of a Flex Application . . . 99
MXML and ActionScript 3 101
Understanding MXML 104
MXML is XML! 104
MXML and containership 110
MXML and nonvisual classes 112
Understanding ActionScript 3 114
ActionScript syntax 114
Declaring variables 114
Conditional statements 117
Looping 119
Combining MXML and ActionScript 120
Using the <fx:Script> element 120
Using external ActionScript files 120
Managing ActionScript code with Flash Builder 124
Using the Application Component 128
Passing application parameters 130
Controlling application dimensions 130
Setting the layout property 131
Summary 134
Trang 13Chapter 5: Using Bindings and Components . . . 135
Using Binding Expressions 136
Shorthand MXML binding expressions 136
Using <fx:Binding> 137
Making expressions bindable 137
Using MXML Components 139
Creating MXML components 139
Instantiating MXML components 144
Adding Properties and Methods to Components 149
Component properties 150
Component methods 152
Using Component Libraries 155
Creating component libraries 155
Using component libraries 159
Creating Flash-based Components 161
Summary 165
Chapter 6: Debugging Flex Applications . . . 167
Debugging Basics 168
The debug version of the application 169
Running an application in debug mode 169
Using trace() and the Logging API 172
Using the trace() function 172
Using the Logging API 175
Using Breakpoints 180
Setting and clearing breakpoints 180
Setting and removing breakpoints in an MXML or ActionScript editor 180
Setting conditional breakpoints 181
Using the Breakpoints view 183
Using breakpoints in a debugging session 185
Inspecting variables and expressions 187
Controlling application execution with the Debug view 192
Profiling Flex Applications 194
Using the Network Monitor 196
Configuring a Flex project for use with ColdFusion 197
Tracing network traffic 201
Summary 206
Chapter 7: Working with Events . . 207
The Flex Event Architecture 208
Handling Events in MXML 210
Declaring event listeners in MXML 210
Working with event objects 213
Trang 14Handling Events with addEventListener() 223
Setting up an event listener 223
Using event name constants 226
Removing an event listener 227
Using Event Bubbling 227
Using Custom Events 230
Declaring custom events 231
Dispatching custom events 233
Handling custom events 235
Using Custom Event Classes 237
Creating the ActionScript class 238
Dispatching a custom event class 242
Handling an event that uses a custom event class 244
Summary 246
Part II: Designing Flex Applications 247 Chapter 8: Using Flex Visual Controls . . . 249
Instantiating and Customizing Controls 250
Instantiating controls with MXML and ActionScript 250
Setting control properties and styles 251
Understanding UIComponent and GraphicElement 251
Using Spark Text Controls 253
Using text control properties 254
Text entry controls 259
Using Layout Controls 263
The HRule and VRule controls 263
The Spacer control 265
Using Button Controls 266
The Button control 266
The LinkButton control 268
The CheckBox control 268
The RadioButton controls 269
Other Data Entry Controls 271
The NumericStepper control 272
Date controls 273
The ColorPicker control 275
Using Interactive Controls 277
The ScrollBar controls 277
The Slider controls 279
Using the Image and BitmapImage Controls 281
Resizing images 283
Embedding images 284
Changing images at runtime 285
Summary 286
Trang 15Chapter 9: Working with Text . . 287
Using Advanced Text Layout 288
Presenting richly formatted text 288
Presenting text in columns 292
Using bidirectional text 292
Controlling Fonts with Cascading Style Sheets 294
Selecting fonts 295
Using device fonts 296
Using embedded fonts 297
Manipulating Text 303
Formatting Text Values 305
Creating formatter objects 305
Setting formatter properties 306
Using formatters in binding expressions 307
Using formatters in static methods 308
Summary 310
Chapter 10: Using Layout Containers . . 311
Using MX Basic Containers 312
Using vertical and horizontal layout containers 312
Using the Canvas container 315
Using MX container styles 317
Using Spark Group Components 319
Using the Group component 320
Using VGroup and HGroup 321
Using the Spark BorderContainer 323
Using Panel Containers 325
Panel properties 326
Using the MX ControlBar container 328
Using Spark panels with control bars 329
Using Constraint-Based Layout 330
Positioning components in Design mode 331
Using constraint properties 332
Sizing Containers and Controls 333
Content-based sizing 333
Absolute sizing 334
Percentage sizing 334
Constraint-based sizing 335
Creating a Scrolling Region 337
Summary 339
Trang 16Chapter 11: Using Cascading Style Sheets . . . 341
About Cascading Style Sheets 341
What Is a Style Sheet? 343
Using Inline Style Declarations 344
Declaring Style Sheets with <fx:Style> 345
Using Style Selectors 346
Using type selectors 346
Using descendant selectors 350
Using style name selectors 351
Using ID selectors 352
Using the global selector 352
Using Embedded Style Sheets 353
Using External Style Sheets 356
Creating a blank style sheet 356
Exporting existing styles 359
Using Compiled Style Sheets 363
Compiling style sheets 363
Loading compiled style sheets 363
Controlling Styles with ActionScript 366
Setting and getting style information 366
Modifying style selectors at runtime 367
Summary 370
Chapter 12: Controlling Animation and Working with Drag and Drop . . . 371
Using Effects 372
Declaring and playing effect classes 373
Declaring effects in ActionScript 375
Using the new Spark effects 377
Using composite effects 383
Using easing classes 387
Using Drag-and-Drop Operations 388
Implementing drag-and-drop with List controls 389
Implementing custom drag-and-drop operations 391
Summary 398
Chapter 13: Managing View States . . . 399
Understanding View States 400
Defining View States in Design View 401
Creating a new state 401
Defining a view state’s overrides 404
Switching View States at Runtime 406
Declaring View States in MXML 407
Adding and removing components 408
Overriding properties, styles, and event handlers 409
Trang 17Managing View States in Components 412
Using Transitions 414
Declaring a transition 414
Using Parallel and Sequence effects in transitions 415
Summary 418
Chapter 14: Declaring Graphics with MXML and FXG . . 419
Declaring Vector Graphics in MXML 420
Drawing lines and shapes 420
Adding visual effects 425
Using FXG Files 432
Creating FXG graphics with Creative Suite software 432
Using FXG files in Flex applications 439
Summary 442
Chapter 15: Skinning Spark Components . . 443
Creating and Using Spark Custom Skins 444
Skinning a Spark application 444
Binding a custom skin to a Spark component 451
Skinning Other Spark Components 455
Creating a new skin 455
Assigning custom skins with CSS 461
Customizing the skin 462
Summary 467
Chapter 16: Managing Application Navigation . . . 469
Understanding Classic Web Navigation 470
Understanding Flex Navigation 471
Using Navigator Containers 471
Declaring a ViewStack in MXML 472
Using custom components in a navigator container 472
Creating a ViewStack in Design mode 473
Working with navigator containers in ActionScript 477
Managing creation policy 482
Managing navigator container dimensions 484
Using Navigator Bar Containers 484
Using a data collection as a dataProvider 485
Handling navigator bar events 487
Using a ViewStack as a dataProvider 487
Managing navigator bar presentation 488
Using Menu Controls 491
Menu data providers 492
Handling menu events 493
Using the Menu control 494
Using the MenuBar control 495
Trang 18Using Other Navigator Containers 497
The TabNavigator container 498
The Accordion container 500
TabNavigator and Accordion keyboard shortcuts 501
Summary 502
Chapter 17: Working with Pop-up Windows . . . 503
Using the Alert Class 504
Presenting pop-up windows with Alert.show() 504
Controlling Alert window modality 504
Managing Alert window buttons 506
Handling Alert window events 508
Using a custom graphical icon 509
Using CSS selectors with the Alert class 512
Using the PopUpMenuButton Control 514
Creating a data provider 514
Handling events 515
Using the PopUpButton control 517
Declaring the pop-up window 518
Handling events and managing pop-up behavior 518
Working with Custom Pop-up Windows 521
Defining a custom pop-up window 521
Managing custom pop-up windows with the PopUpManager class 524
Summary 530
Part III: Working with Data 531 Chapter 18: Modeling and Managing Data . . 533
Creating a Data Model 534
Using the <fx:Model> element 535
Using Value Objects 539
Using the New ActionScript Class wizard 540
Value object class syntax 541
Instantiating value object classes 549
Using Data Collections 552
Declaring an ArrayCollection 553
Setting a data collection object’s source property 554
Accessing data at runtime 555
Managing data at runtime 556
Using data cursors 562
Summary 569
Chapter 19: Using List Controls . . . 571
Using Data Providers 574
Using hard-coded data providers 575
Using dynamic data providers 577
Trang 19Controlling List Item Labels 579
Using the labelField property 579
Using the labelFunction property 582
List Control Events and Properties 584
Handling User Data Selections 585
Using the change event 585
Using the selectedItem property 585
Using the selectedIndex property 587
Selecting complex data objects 588
Using Custom Item Renderers 590
Using drop-in item renderers 591
Using inline renderers and editors 593
Using component item renderers 597
Customizing Spark item renderers with view states 600
Summary 602
Chapter 20: Using Advanced List Controls . . . 603
Using ComboBox and DropDownList Controls 603
Using the prompt property 604
Using the ComboBox control 605
Selecting complex data objects with ActionScript 607
Using the Spark ButtonBar control 611
Using the DataGrid Control 613
Customizing the DataGrid display 614
Displaying custom labels in DataGrid column cells 619
Advanced Item Renderers and Editors 622
Using the dataChange event 623
Using Spark item renderers 626
Using item editors 627
Using List Controls with Horizontal and Tile Layout 635
Using the AdvancedDataGrid Control 641
Hierarchical data display 641
Grouping flat data 644
Summary 646
Chapter 21: Using the Flex Charting Controls . . . 647
Understanding Flex’s Types of Charts 648
Declaring Chart Controls 650
Setting Chart Properties and Styles 652
Using pie charts 652
Using financial charts 663
Using bar, column, line, and area charts 666
Summary 673
Trang 20Chapter 22: Working with Data Entry Forms . . 675
Using the Form Container 676
Using the FormHeading control 678
Using the FormItem container 680
Setting a default button 681
Using Custom Form Components 683
Creating a custom Form component 683
Adding controls to a Form component 685
Validating Data Entry 687
Creating a validator object 688
Controlling validation with trigger events 688
Controlling validation with ActionScript 691
Controlling validation rules and error messages 695
Sharing Data with the Application 697
Modeling Form data with a value object 697
Dispatching a custom event 699
Summary 705
Chapter 23: Working with HTTPService and XML . . 707
Using RPC and REST Architectures 708
Understanding the Representational State Transfer architecture 708
Understanding the Remote Procedure Call architecture 709
Creating Data-Centric Applications with Flash Builder 4 710
Creating and managing data connections 710
Defining a return data type 714
Binding returned data to visual controls 719
Declaring and Configuring HTTPService Objects 722
Creating an HTTPService object 722
Essential HTTPService properties 723
Sending and Receiving Data 727
Understanding asynchronous communications 727
Handling HTTPService responses 727
Working with CallResponder and AsyncToken 736
Working with ItemResponder and AsyncToken 739
Working with Value Objects 741
Passing Parameters to Server Pages 744
Using named parameters 744
Using bound parameters 745
Handling Cross-Domain Policy Issues 746
Summary 748
Trang 21Chapter 24: Managing XML with E4X . . . 749
Using XML Classes 750
Creating an XML object 751
Using the XMLList class 754
Using the XMLListCollection class 755
Using E4X Expressions 756
Extracting data from XML objects 758
Modifying data in XML objects 765
Working with Namespaces 770
Summary 774
Part IV: Integrating Flex Applications with Application Servers 775 Chapter 25: Working with SOAP-Based Web Services . . . 777
Understanding SOAP 778
Understanding WSDL 780
Using the WebService Component 783
Installing ColdFusion 783
Creating a WebService object 784
Handling Web service results 786
Passing parameters to Web service operations 796
Using Web Service Data Connections 798
Defining a data connection 799
Managing Web service data connections 801
Summary 805
Chapter 26: Integrating Flex Applications with BlazeDS and Java . . . 807
Using BlazeDS 808
Understanding supported platforms 808
Getting started with BlazeDS 809
Creating Flex Projects for Use with BlazeDS 814
Using the Proxy Service 817
Configuring the Proxy Service 817
Using the default destination 818
Using named destinations 822
Using the Remoting Service 824
Creating and exposing Java classes 825
Configuring Remoting Service destinations 828
Using the RemoteObject Component 830
Instantiating the RemoteObject component 830
Calling remote methods 830
Handling RemoteObject results 831
Passing arguments to remote methods 838
Trang 22Passing data between ActionScript and Java 840Using value object classes 841Working with BlazeDS Data Connections in Flash Builder 4 845Enabling RDS with BlazeDS 846Defining BlazeDS data connections 847Summary 848
Chapter 27: Using the Message Service with BlazeDS . . . 849
Understanding the Message Service 850Configuring Messaging on the Server 851Configuring channels for messaging 851Configuring messaging adaptors and destinations 854Creating a Flex Messaging Application 856Creating a Flex project 856Sending messages 857Receiving and processing messages 858Sending and Receiving Complex Data 862Filtering Messages on the Server 865Using the selector property 865Using subtopics 866Tracing Messaging Traffic 871Summary 872
Chapter 28: Integrating Flex Applications with ColdFusion . . . 873
Understanding Flash Remoting and ColdFusion 874Creating a Flex project for use with ColdFusion 875Configuring Flash Remoting on the server 877Creating ColdFusion Components for Flex 878Using CFCs with the RemoteObject Component 880Setting the source property 881Creating a RemoteObject instance 881Calling CFC functions 882Handling CFC Function Results 883Using binding expressions 883Using the result event 884Handling results from multiple CFC functions 888Passing Arguments to CFC Functions 891Using explicit arguments 891Using bound arguments 892Using named arguments 892Using Value Object Classes 894Creating a ColdFusion value object 894Creating an ActionScript value object 895Returning value objects from ColdFusion to Flex 896
Trang 23Receiving value objects from ColdFusion 897Passing value object arguments to CFC functions 899Working with RemoteObject Faults 900Handling the fault event 900Generating custom exceptions from a CFC function 901Working with Data Connections in Flash Builder 903Calling ColdFusion 9 Services 905Configuring ColdFusion security 905Using ColdFusion 9 client-side service components 907Summary 910
Chapter 29: Integrating Flex Applications with PHP . . . 911
Installing PHP 912Installing WampServer on Windows 913Managing WampServer 914Installing MAMP on Mac OS X 916Managing MAMP servers 917Creating a Flex Project for Use with PHP 919Using PHP with HTTPService and XML 922Using the PHP SimpleXML extension 922Retrieving XML data with HTTPService 923Using PHP and Remoting with Zend AMF 924Installing Zend AMF 925Creating a service class in PHP 927Calling a PHP class with RemoteObject 928Returning complex data from Zend AMF 929Understanding ActionScript to PHP data serialization 932Using PHP Data Connections in Flash Builder 932Defining data connections 932Generating a service based on a database table structure 935Summary 938
Chapter 30: Localizing Flex 4 Applications . . . 941
Using Locales to Select Application Resources 941Changing locales at compile time 943Changing locales at runtime 944Using Custom Resource Bundles 947Creating resource bundles at runtime 947Using external resource bundles 950Summary 954
Trang 24Chapter 31: Deploying Desktop Applications with Adobe AIR . . 955
Understanding AIR Architecture 956Installing Adobe AIR 958Downloading the AIR installer 958Installing and uninstalling AIR on Windows 958Installing and uninstalling AIR on Mac OS X 959Creating a Flex Desktop Application 960Creating a Flex desktop application project 960Using the application descriptor file 963Packaging a release version of an AIR application 967Installing AIR applications 969Uninstalling AIR applications 971Flex Application Tips and Tricks with AIR 971Debugging AIR applications in Flash Builder 972Working with HTML-based content 973Using the WindowedApplication component 977Creating Remoting channels at runtime 978
A Conclusion about Adobe AIR 980Summary 981
Index . . . 983
Trang 25benefits of being connected to the Internet, including access to various types of Web-based vices, but would solve many of the nagging issues that had been inherent in browser-based appli-cations since the mid-1990s Using Flash Player to host graphically rich applications delivered as Flash documents would address issues such as the ongoing differences between Web browsers in implementation of Cascading Style Sheets (CSS) and JavaScript And because such applications would be able to leverage Flash Player’s original strengths, including animation and delivery of rich media (audio and video) to the desktop, the applications could be both functional and visually compelling
ser-The first push into the new frontier of RIAs met with mixed success Many applications built and delivered with Flash MX and ColdFusion MX (Macromedia’s recommended middleware applica-tion server software at the time) were very impressive Perhaps the best known of this class is the iHotelier hotel reservations application, which is still used by many large hotels around the world
The application presents customers with a Flash-based interface they can use to find and reserve hotel rooms from a visually intuitive single-screen interface A customer can input information and get a nearly instantaneous response without having to navigate the multi-page interface of classic HTML-based Web applications
Meanwhile, developers who were creating these applications were madly pulling their hair out
Building data-centric applications in Flash meant that they were working with a binary source file, making it difficult to integrate with source control systems At the time, ActionScript wasn’t partic-ularly object-oriented (although this part of the situation improved drastically with the release of ActionScript 2 in Flash MX 2004), and there was no enforcement of code placement standards Its loose data typing and lack of strong compile-time error checking or debugging tools led to phe-nomena such as “silent failure” — the moment when something that’s supposed to happen doesn’t, and no information is offered as to the reason
In large multi-developer environments, figuring out where to put the code in a Flash document was a significant part of the application planning process, because the product wasn’t really designed for application development And the ActionScript editor built into Flash gave experi-enced developers fits Java developers, in particular, were used to sophisticated code editors, and working in Flash slowed their productivity and increased their frustration