Introduction


It's just a few short years since Macromedia coined the term rich Internet application. Back then, the idea felt somewhat futuristic, but all that has changed. rich Internet applications (or RIAs, as we affectionately refer to them) are reality and they are here right now.

Macromedia released Flex a couple of years ago, making it possible for developers to write applications that take advantage of the incredibly prevalent Flash platform. These applications don't just look great; they also are truly portable, can be fully accessible, and (most importantly) dramatically change the end user experience replacing the page request model of the web to something far more elegant and usable. Something richer.

Numerous organizations have discovered the benefits of Flex and have successfully built and deployed applications that run on top of the Flash platform. The highest profile of these is Yahoo!, which created the next generation of Yahoo! Maps in Flex. But despite the early Flex successes, Flex 1 was most definitely not a mass market product. Pricing, tooling, deployment options, and more meant that Flex 1 was targeted specifically for larger and more-complex applications, as well as for more-sophisticated developers and development. But this has now changed.

Now part of the Adobe family, Flex 2 was released mid 2006a brand new Flex with a new integrated development environment (IDE), new pricing, new deployment options, a new scripting language, and a brand new Flash Player too. Flex 2 is most definitely a mass market product, designed to bring the values and benefits of RIAs to all developers.

Getting started with Flex is pretty easy. MXML tags are easy to learn (especially when Flex Builder writes many of them for you). ActionScript has a steeper learning curve, but developers with prior programming and scripting experience will pick it up easily. But there is more to Flex development than MXML and ActionScript.

There are many things that need to be understood to be a successful Flex developer, including the following:

  • How Flex applications should be built (and how they should not)

  • Relationships between MXML and ActionScript, and when to use each

  • Various ways to interact with back-end data, and the differences between each

  • How to use the Flex components, and know how to write their own

  • Performance implications of the code they write and how it is written

  • Best practices to write code that is scalable and manageable and reusable (there is definitely more to Flex than MXML and ActionScript)

And this is where this book comes in. Matthew Boles, James Talbot, and Jeff Tapper (ably assisted by Benjamin Elmore and Michael Labriola) have distilled their hard-earned Flex expertise into a series of lessons that will jump-start your own Flex development. Starting with the basics and then incrementally introducing additional functionality and know-how, the author team will guide your journey into the exciting world of RIAs, ensuring success at every step of the way.

Flex 2 is powerful, highly capable, fun, and incredibly addictive, too. And Adobe Flex 2: Training from the Source is the ideal tour guide on your journey to the next generation of application development.

Enjoy the ride!

Ben Forta
SeniorTechnical Evangelist
Adobe Systems, Inc.

Prerequisites

To make the most of this course, you should at the very least understand web terminology. This book isn't designed to teach you anything more than Flex, so the better your understanding of the World Wide Web, the better off you'll be. This book is written assuming that you are comfortable working with programming languages and are probably working with a server-side language such as Java, .Net, PHP, ColdFusion, or a similar technology. Although knowledge of server-side technologies is not required to succeed with this book, there are many comparisons and analogies made to server-side web programming. This book is not intended as an introduction to programming or as an introduction to object-oriented programming (OOP). Experience with OOP is not required, although if you have no programming experience at all, you might find the materials too advanced.

Outline

As you'll soon discover, this book mirrors real-world practices as much as possible. Where certain sections of the book depart from what would be considered a real-world practice, every attempt has been made to inform you. The exercises are designed to get you using the tools and the interface quickly so that you can begin to work on projects of your own with as smooth a transition as possible.

This curriculum should take approximately 3840 hours to complete and includes the following lessons:

Lesson 1: Understanding Rich Internet Applications

Lesson 2: Getting Started

Lesson 3: Laying Out the Interface

Lesson 4: Using Simple Controls

Lesson 5: Handling Events and Data Structures

Lesson 6: Using Remote XML Data with Controls

Lesson 7: Creating Components with MXML

Lesson 8: Using Controls and Repeaters with Data Sets

Lesson 9: Using Custom Events

Lesson 10: Creating Custom Components with ActionScript 3.0

Lesson 11: Using DataGrids and Item Renderers

Lesson 12: Using Drag and Drop

Lesson 13: Implementing Navigation

Lesson 14: Using Formatters and Validators

Lesson 15: Using the History Manager

Lesson 16: Customizing the Look and Feel of a Flex Application

Lesson 17: Accessing Server-side Objects

Lesson 18: Charting Data

Lesson 19: Introducing Adobe Flex Data Services

Lesson 20: Pushing Data with Adobe Flex Data Services

Lesson 21: Synchronizing Data with Adobe Flex Data Services

Lesson 22: Creating Transitions and Behaviors

Lesson 23: Printing From Flex

Lesson 24: Using Shared Objects

Lesson 25: Debugging Flex Applications

Appendix A: Setup Instructions

Technical Notes

Before getting started, you should follow the setup instructions in the appendix to ensure that you have the environment set up properly for use with this book.

Much of the data for the hands-on tasks is retrieved from www.flexgrocer.com. Of course, you must have an Internet connection to access this site. In lieu of this, you can start the ColdFusion server instance, as detailed in the appendix, "Setup Instructions," and change the URL from http://www.flexgrocer.com/ to http://localhost:8300/ and access the data locally. For example, in Lesson 6, "Using Remote XML Data with Controls," simply replace http://www.flexgrocer.com/units.xml with http://localhost:8300/units.xml to access the same XML data without an Internet connection.

Throughout the book, we use this wording: "Data type the function as void" or "Data type the function as String." This is just to make the instructions simpler; the authors realize the function itself is not data typedwhat is really being data typed is the value the function returns.

Who Is this Book For?

Macintosh and Windows users of Flex Builder 2 can complete all the exercises in Lessons 1-16. Lessons 17-25, however, cover Flex Data Services, which only runs under Windows. Macintosh users can continue with those Chapters if they have access to a Flex Data server running on a separate machine. Setting up that server and connecting to it is, alas, beyond the scope of this book.

The Project Application

Adobe Flex 2: Training from the Source includes many comprehensive tutorials designed to show you how to create a complete application using Flex 2. This application is an "online grocery store" that displays data and images and then submits completed orders to the server. It includes an executive Dashboard to enable store managers to view real-time graphs showing sales details, as well as a data-entry application for adding or editing the products sold by the grocery.

By the end of 25 hands-on lessons, you will have built an entire web site using Flex. You will begin by learning the fundamentals of Flex and understanding how Flex Builder can be used to aid in developing applications. In the early lessons, you will make use of Design mode to begin laying out the application, but as you progress through the book and become more comfortable with the languages used by Flex, you will spend more and more time working in Source mode, which gives you the full freedom and flexibility of coding. By the end of the book, you should be fully comfortable working with the Flex languages and can probably work even without Flex Builder by using the freely available Flex 2 SDK and command-line compiler.

Standard Elements in the Book

Each lesson in this book begins by outlining the major focus of the lesson at hand and introducing new features. Learning objectives and the approximate time needed to complete all the exercises are also listed at the beginning of each lesson. The projects are divided into exercises that explain the importance of each skill you learn. Every lesson will build on the concepts and techniques used in the previous lessons.

Tips (): Alternative ways to perform tasks and suggestions to consider when applying the skills you are learning.

Notes (): Additional background information to expand your knowledge and advanced techniques you can explore to further develop your skills.

Cautions (): Information warning you of situations you might encounter that could cause errors, problems, or unexpected results.

Boldface text: Words that appear in boldface are terms that you must type while working through the steps in the lessons.

Boldface code: Lines of code that appear in boldface within code blocks help you easily identify changes in the block that you are to make in a specific step in a task.

<mx:HorizontalList dataProvider="{dp}"     labelFunction="multiDisplay"     columnWidth="130"     width="850"/> 


Code in text: Code or keywords appear slightly different from the rest of the text so you can identify them.

To help you easily identify ActionScript, XML, and HTML code within the book, the code has been styled in a special font that's unique from the rest of the text. Single lines of code that are longer than the margins of the page allow wrap to the next line. They are designated by an arrow at the beginning of the continuation of a broken line and are indented under the line from which they continue. For example:

[View full width]

public function Product (_catID:Number, _prodName:String, _unitID:Number, _cost:Number, _listPrice:Number, _description:String, _isOrganic:Boolean, _isLowFat:Boolean, _imageName :String)


Italicized text: Words that appear in italics are either for emphasis or are new vocabulary.

Italics are also used on placeholders, in which the exact entry may change depending upon your situation. For example: driveroot:/flex2tfs/flexGrocer, where the driveroot is dependent upon your operating system.

Menu commands and keyboard shortcuts: There are often multiple ways to perform the same task in Flash. The different options will be pointed out in each lesson. Menu commands are shown with angle brackets between the menu names and commands: Menu > Command > Subcommand. Keyboard shortcuts are shown with a plus sign between the names of keys to indicate that you should press the keys simultaneously; for example, Shift+Tab means that you should press the Shift and Tab keys at the same time.

Appendix: This book includes one appendix that will guide you through the steps to set up the working environment required to execute the exercises in this book.

CD-ROM: The CD-ROM included with this book includes all the media files, starting files, and completed projects for each of the lessons in the book. These files are located in the assets, start, or complete directories, respectively. Lesson 1, "Understanding Rich Internet Applications," does not include tasks; however, the CD-ROM includes media in the directory Lesson 1. This media provides the flexGrocer directory for your project. At any point you need to return to the original source material, you can restore the flexGrocer. Some lessons include an intermediate directory, which contains files in various stages of development in the lesson. Any time you want to reference one of the files being built in a lesson to verify that you are correctly executing the steps in the exercises, you will find the files organized on the CD-ROM under the corresponding lesson. For example, the files for Lesson 4 are located on the CD-ROM in the Lesson 4 folder.

The directory structure of the lessons you will be working with is as follows:

Adobe Training from the Source

The Adobe Training from the Source and Advanced Training from the Source series are developed in association with Adobe and reviewed by the product support teams. Ideal for active learners, the books in the Training from the Source series offer hands-on instruction designed to provide you with a solid grounding in the program's fundamentals. If you learn best by doing, this is the series for you. Each Training from the Source title contains hours of instruction on Adobe software products. They are designed to teach the techniques that you need to create sophisticated professional-level projects. Each book includes a CD-ROM that contains all the files used in the lessons, completed projects for comparison, and more.

Adobe Authorized Training and Certification

This book is geared to enable you to study at your own pace with content from the source. Other training options exist through the Adobe Authorized Training Partner program. Get up to speed in a matter of days with task-oriented courses taught by Adobe Certified Instructors. Or learn on your own with interactive online training from Adobe University. All these sources of training will prepare you to become an Adobe Certified Developer.

For more information about authorized training and certification, check out www.adobe.com/training/.

What You Will Learn

You will develop the skills you need to create and maintain your own Flex applications as you work through these lessons.

By the end of the course, you will be able to:

  • Use Flex Builder to build Flex applications

  • Understand MXML, ActionScript 3.0, and the interactions of the two

  • Work with complex sets of data

  • Load data from a server using XML, web services, and Remote objects

  • Handle events to allow interactivity in an application

  • Create your own custom events

  • Create your own components, in either MXML or ActionScript 3.0

  • Apply styles and skins to customize the look and feel of an application

  • Add charts to an application

  • And much more...

Minimum System Requirements

Windows

  • Intel Pentium 4 processor

  • Microsoft Windows XP with Service Pack 2, Windows XP Professional, Windows 2000 Server, Windows 2000 Pro, or Windows Server 2003

  • 512MB of RAM (1GB recommended)

  • 700MB of available hard-disk space

  • Java Virtual Machine: Sun JRE 1.4.2, Sun JRE 1.5, IBM JRE 1.4.2

Macintosh

  • Flex Builder for Macintosh is not available at the time this book went to the printers, but is expected shortly.

The Flex line of products is extremely exciting, and we're waiting to be amazed by what you will do with it. With a strong foundation in Flex, you can grow and expand your skillset quickly. Flex is really not too difficult to use for anyone with programming experience. With a little bit of initiative and effort, you can fly through the following lessons and be building your own custom applications and sites in no time.




Adobe Flex 2.Training from the Source
Adobe Flex 2: Training from the Source
ISBN: 032142316X
EAN: 2147483647
Year: 2006
Pages: 225

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net