0% found this document useful (0 votes)
14 views39 pages

(Ebook) Foundation Flex For Developers: Data-Coldfusion, and Lcds by Sas Jacobs Isbn 9781590598948, 1590598946 Download

The document is an overview of the ebook 'Foundation Flex for Developers' by Sas Jacobs, which focuses on creating data-driven applications using various technologies like PHP, ASP.NET, and ColdFusion. It includes information about the book's contents, authors, and ISBN details, as well as links to download the ebook and other related ebooks. The book covers essential topics such as Flex application basics, data-driven applications, and LiveCycle Data Services.

Uploaded by

hesinfuenla95
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views39 pages

(Ebook) Foundation Flex For Developers: Data-Coldfusion, and Lcds by Sas Jacobs Isbn 9781590598948, 1590598946 Download

The document is an overview of the ebook 'Foundation Flex for Developers' by Sas Jacobs, which focuses on creating data-driven applications using various technologies like PHP, ASP.NET, and ColdFusion. It includes information about the book's contents, authors, and ISBN details, as well as links to download the ebook and other related ebooks. The book covers essential topics such as Flex application basics, data-driven applications, and LiveCycle Data Services.

Uploaded by

hesinfuenla95
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 39

(Ebook) Foundation Flex for Developers: Data-

Driven Applications with PHP, ASP.NET,


ColdFusion, and LCDS by Sas Jacobs ISBN
9781590598948, 1590598946 download
https://ebooknice.com/product/foundation-flex-for-developers-
data-driven-applications-with-php-asp-net-coldfusion-and-
lcds-1364620

Explore and download more ebooks at ebooknice.com


Here are some recommended products that we believe you will be
interested in. You can click the link to download.

(Ebook) Biota Grow 2C gather 2C cook by Loucas, Jason; Viles, James


ISBN 9781459699816, 9781743365571, 9781925268492, 1459699815,
1743365578, 1925268497

https://ebooknice.com/product/biota-grow-2c-gather-2c-cook-6661374

(Ebook) Matematik 5000+ Kurs 2c Lärobok by Lena Alfredsson, Hans


Heikne, Sanna Bodemyr ISBN 9789127456600, 9127456609

https://ebooknice.com/product/matematik-5000-kurs-2c-larobok-23848312

(Ebook) SAT II Success MATH 1C and 2C 2002 (Peterson's SAT II Success)


by Peterson's ISBN 9780768906677, 0768906679

https://ebooknice.com/product/sat-ii-success-
math-1c-and-2c-2002-peterson-s-sat-ii-success-1722018

(Ebook) Master SAT II Math 1c and 2c 4th ed (Arco Master the SAT
Subject Test: Math Levels 1 & 2) by Arco ISBN 9780768923049,
0768923042

https://ebooknice.com/product/master-sat-ii-math-1c-and-2c-4th-ed-
arco-master-the-sat-subject-test-math-levels-1-2-2326094
(Ebook) Cambridge IGCSE and O Level History Workbook 2C - Depth Study:
the United States, 1919-41 2nd Edition by Benjamin Harrison ISBN
9781398375147, 9781398375048, 1398375144, 1398375047

https://ebooknice.com/product/cambridge-igcse-and-o-level-history-
workbook-2c-depth-study-the-united-states-1919-41-2nd-edition-53538044

(Ebook) Foundation XML and E4X for Flash and Flex by Sas Jacobs ISBN
9781430216346, 1430216344

https://ebooknice.com/product/foundation-xml-and-e4x-for-flash-and-
flex-1393598

(Ebook) Flex Solutions: Essential Techniques for Flex 2 and 3


Developers by Marco Casario ISBN 9781590598764, 1590598768

https://ebooknice.com/product/flex-solutions-essential-techniques-for-
flex-2-and-3-developers-1354994

(Ebook) Beginning jQuery 2 for ASP.NET Developers: Using jQuery 2 with


ASP.NET Web Forms and ASP.NET MVC by Bipin Joshi (auth.) ISBN
9781430263043, 9781430263050, 1430263040, 1430263059

https://ebooknice.com/product/beginning-jquery-2-for-asp-net-
developers-using-jquery-2-with-asp-net-web-forms-and-asp-net-
mvc-4634656

(Ebook) Pro ASP.NET for SQL Server: High Performance Data Access for
Web Developers by Brennan Stehling ISBN 9781590598603, 1590598601

https://ebooknice.com/product/pro-asp-net-for-sql-server-high-
performance-data-access-for-web-developers-43040428
8946Ch00CMP4 11/12/07 8:46 AM Page i

Foundation Flex
for Developers
Data-Driven Applications with
PHP, ASP.NET, ColdFusion, and LCDS

Sas Jacobs with Koen De Weggheleire


8946Ch00CMP4 11/12/07 8:46 AM Page ii

Foundation Flex for Developers


Data-Driven Applications with
PHP, ASP.NET, ColdFusion, and LCDS
Copyright © 2008 by Sas Jacobs with Koen De Weggheleire
All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means, electronic or mechanical,
including photocopying, recording, or by any information storage or retrieval system, without the prior written permission
of the copyright owner and the publisher.
ISBN-13 (pbk): 978-1-59059-894-8
ISBN-10 (pbk): 1-59059-894-6
ISBN-13 (electronic): 978-1-4302-0443-5
ISBN-10 (electronic): 1-4302-0443-5
Printed and bound in the United States of America 9 8 7 6 5 4 3 2 1
Trademarked names may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name,
we use the names only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement
of the trademark.
Distributed to the book trade worldwide by Springer-Verlag New York, Inc., 233 Spring Street, 6th Floor, New York, NY 10013.
Phone 1-800-SPRINGER, fax 201-348-4505, e-mail [email protected], or visit www.springeronline.com.
For information on translations, please contact Apress directly at 2855 Telegraph Avenue, Suite 600, Berkeley, CA 94705.
Phone 510-549-5930, fax 510-549-5939, e-mail [email protected], or visit www.apress.com.
The information in this book is distributed on an “as is” basis, without warranty. Although every precaution has been taken in the
preparation of this work, neither the author(s) nor Apress shall have any liability to any person or entity with respect to any loss or
damage caused or alleged to be caused directly or indirectly by the information contained in this work.
Java™ and all Java-based marks are trademarks or registered trademarks of Sun Microsystems, Inc., in the US and other countries.
Apress, Inc., is not affiliated with Sun Microsystems, Inc., and this book was written without endorsement from Sun Microsystems, Inc.
The source code for this book is freely available to readers at www.friendsofed.com in the Downloads section.

Credits
Lead Editors Production Editor
Chris Mills, Matthew Moodie Elizabeth Berry

Technical Reviewer Compositor


Charles Brown Diana Van Winkle

Editorial Board Proofreaders


Steve Anglin, Ewan Buckingham, Tony Campbell, Patrick Vincent, April Eddy
Gary Cornell, Jonathan Gennick, Jason Gilmore,
Kevin Goff, Jonathan Hassell, Matthew Moodie, Indexer
Joseph Ottinger, Jeffrey Pepper, Ben Renow-Clarke, Odessa&Cie
Dominic Shakeshaft, Matt Wade, Tom Welsh
Artist
Project Manager Diana Van Winkle
Beth Christmas
Cover Image Designer
Copy Editor Corné van Dooren
Nancy Sixsmith
Interior and Cover Designer
Associate Production Director Kurt Krames
Kari Brooks-Copony
Manufacturing Director
Tom Debolski
8946Ch00CMP4 11/12/07 8:46 AM Page iii

For my partner David, who has supported and loved me


while writing this book. And for our son, whose birth
interrupted the writing process. I love you both.

Sas Jacobs
8946Ch00CMP4 11/12/07 8:46 AM Page iv
8946Ch00CMP4 11/12/07 8:46 AM Page v

CONTENTS AT A GLANCE

About the Authors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix


About the Technical Reviewer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxi
About the Cover Image Designer . . . . . . . . . . . . . . . . . . . . . . . . . . xxiii
Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii

PART 1 FLEX APPLICATION BASICS


Chapter 1 Introduction to Flex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Chapter 2 Working with ActionScript 3.0 in Flex 3 . . . . . . . . . . . . . 17
Chapter 3 Creating Custom Components . . . . . . . . . . . . . . . . . . . . . 47
Chapter 4 Interacting with Users . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
Chapter 5 Interacting with the Web Browser . . . . . . . . . . . . . . . . . 119
Chapter 6 Working with Data in Flex Applications . . . . . . . . . . . . . 147
Chapter 7 Introduction to XML . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
Chapter 8 Using XML in Flex Builder . . . . . . . . . . . . . . . . . . . . . . . . 227
Chapter 9 Flex Data-Driven Controls . . . . . . . . . . . . . . . . . . . . . . . 267
Chapter 10 Debugging Flex Applications . . . . . . . . . . . . . . . . . . . . 311

PART 2 DATA-DRIVEN APPLICATIONS


Chapter 11 XML Case Study . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333
Chapter 12 ColdFusion Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357
Chapter 13 ASP.NET Case Study . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375
Chapter 14 PHP Case Study . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 421

PART 3 LIVECYCLE DATA SERVICES


Chapter 15 Introduction to LiveCycle Data Services . . . . . . . . . . . 469
Chapter 16 LiveCycle Data Services Case Study . . . . . . . . . . . . . . . 511

Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 534

v
8946Ch00CMP4 11/12/07 8:46 AM Page vi
8946Ch00CMP4 11/12/07 8:46 AM Page vii

CONTENTS

About the Authors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix


About the Technical Reviewer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxi
About the Cover Image Designer . . . . . . . . . . . . . . . . . . . . . . . . . . xxiii
Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii

PART 1 FLEX APPLICATION BASICS


Chapter 1 Introduction to Flex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Understanding web applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Understanding the role of Flex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Understanding the role of MXML and ActionScript 3.0 . . . . . . . . . . . . . . . . . . . . . . 6
Understanding MXML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Understanding ActionScript 3.0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Understanding the major changes in ActionScript 3.0 . . . . . . . . . . . . . . . . . . . . . 9
Working with applications in Flex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Working with data in Flex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Flex tools for working with data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
The application development process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Useful resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

Chapter 2 Working with ActionScript 3.0 in Flex 3 . . . . . . . . . . . . . . 17


Working with ActionScript 3.0 in Flex applications . . . . . . . . . . . . . . . . . . . . . . . . 18
Using inline ActionScript statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Using the <mx:Script> element . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Using the source attribute in <mx:Script> . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Using include inside an <mx:Script> element . . . . . . . . . . . . . . . . . . . . . . . . . 27
Creating custom class files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Understanding packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Understanding custom classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Working through an example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

vii
8946Ch00CMP4 11/12/07 8:46 AM Page viii

CONTENTS

Creating ActionScript projects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36


Working with a minimal Flex interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Additional points . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Understanding ActionScript 3.0 events . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Creating bindable properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
What happened to trace? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
ActionScript 3.0 best practices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Declaring data types appropriately . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Importing classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Creating appropriate packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44

Chapter 3 Creating Custom Components . . . . . . . . . . . . . . . . . . . . . . 47


Creating components using MXML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Example: Creating a country ComboBox component . . . . . . . . . . . . . . . . . . . . . 49
Passing a value to the component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Binding a property in the component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
Dispatching events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Creating a custom event class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
Creating a composite component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
Creating components using ActionScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Working through examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Passing values to ActionScript components . . . . . . . . . . . . . . . . . . . . . . . . . . 65
Dispatching custom events in ActionScript components . . . . . . . . . . . . . . . . . . . 66
Deciding on MXML or ActionScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
Creating simple components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
Creating composite components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
Creating nonvisual components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
Modifying component behavior . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
Creating a new component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
Using the code-behind approach . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
Sharing components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
Distributing SWC files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
Using SWC files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
Distributing Runtime Shared Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72

Chapter 4 Interacting with Users . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75


Working with the Alert control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
Adding a message and title . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
Adding buttons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
Setting the parent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
Adding a closeHandler method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
Setting the iconClass argument . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
Setting the defaultButtonFlag argument . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
A simple example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
Changing the appearance of the alert . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
Changing the size of the alert . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82

viii
8946Ch00CMP4 11/12/07 8:46 AM Page ix

CONTENTS

Changing the button labels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83


Changing the button size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
A simple example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
Working with pop-ups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
A simple example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
Passing values from the pop-up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
Passing values to the pop-up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
Responding to pop-up events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
Working with forms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
Understanding the Form container . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
Working with a data model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
Using the <mx:Model> tag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
Determining required values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
Validating user input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
Working with the CreditCardValidator . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
Working with the CurrencyValidator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
Working with the DateValidator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
Working with the EmailValidator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
Working with the NumberValidator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
Working with the PhoneNumberValidator . . . . . . . . . . . . . . . . . . . . . . . . . . 106
Working with the RegExpValidator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
Working with the SocialSecurityValidator . . . . . . . . . . . . . . . . . . . . . . . . . . 106
Working with the StringValidator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
Working with the ZipCodeValidator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
Adding validation to a form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
Validating with validator events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
Validating with ActionScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
Formatting user input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
Using the CurrencyFormatter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
Using the DateFormatter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
Using the NumberFormatter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
Using the PhoneFormatter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
Using the ZipCodeFormatter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
Applying the formatter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
Adding formatters to a form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117

Chapter 5 Interacting with the Web Browser . . . . . . . . . . . . . . . . . 119


Loading a web page from Flex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
Sending variables when calling a web page . . . . . . . . . . . . . . . . . . . . . . . . . 121
Calling JavaScript with navigateToURL . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
Working through a simple example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
Sending variables into a SWF file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
Using querystring parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
Modifying the Flex wrapper files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
Accessing querystring variables in Flex . . . . . . . . . . . . . . . . . . . . . . . . . . 126
Working through an example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
Using flashVars . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128

ix
8946Ch00CMP4 11/12/07 8:46 AM Page x

CONTENTS

Understanding the External API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130


Scripting the ExternalInterface class . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
Calling a JavaScript function using ActionScript . . . . . . . . . . . . . . . . . . . . . . . 131
Calling an ActionScript function with JavaScript . . . . . . . . . . . . . . . . . . . . . . . 135
Working through a two-way communication example . . . . . . . . . . . . . . . . . . . 139
Limitations of the External API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
Understanding Flash Player security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145

Chapter 6 Working with Data in Flex Applications . . . . . . . . . . . . . 147


Sources of external data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
Working with the HTTPService class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
Creating an HTTPService request . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
Making the request . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
Receiving a response . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
Specifying a return type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
Accessing loaded content . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
Sending variables with the request . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
Specifying a request method and format . . . . . . . . . . . . . . . . . . . . . . . . . . 151
Properties of the HTTPService class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
Methods of the HTTPService class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
Events of the HTTPService class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
Understanding the URLLoader class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
Creating a URLLoader request . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
Making the request . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
Receiving a response . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
Specifying a return type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
Sending variables with the request . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
Specifying a request method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
Properties of the URLLoader class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
Methods of the URLLoader class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
Events of the URLLoader class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
Comparing the HTTPService and URLLoader . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
Loading information from text files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
Using the <mx:HTTPService> tag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
Using the HTTPService class with ActionScript . . . . . . . . . . . . . . . . . . . . . . . . 159
Using the URLLoader class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
Loading information stored in variable pairs . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
Using variable pairs with the HTTPService class . . . . . . . . . . . . . . . . . . . . . . . 161
Using variable pairs with the URLLoader class . . . . . . . . . . . . . . . . . . . . . . . . 162
Using the <mx:HTTPService> tag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
Using the HTTPService class with ActionScript . . . . . . . . . . . . . . . . . . . . . . . . 164
Using the URLLoader class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
Sending data to the server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
Sending variables with the HTTPService class . . . . . . . . . . . . . . . . . . . . . . . . 166
Sending variables with the URLLoader . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
Other considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
Working through an example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
Updating content with the HTTPService class . . . . . . . . . . . . . . . . . . . . . . . . 167

x
8946Ch00CMP4 11/12/07 8:46 AM Page xi

CONTENTS

Updating content with the URLLoader class . . . . . . . . . . . . . . . . . . . . . . . . . 172


Understanding Flash Player 9 security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
Understanding security sandboxes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
Creating a cross-domain policy file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
Proxying data locally . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
Separating data from presentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
Working with the <mx:Model> tag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
Using ActionScript to work with complex data structures . . . . . . . . . . . . . . . . . 179
Understanding data binding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
Binding with curly braces syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
Including a calculation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
Concatenating values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
Adding conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
Using an ActionScript function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
Binding with the <mx:Binding> tag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
Including a calculation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
Concatenating values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
Adding conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
Using an ActionScript function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
Working through an example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
Binding with ActionScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
Using bindProperty . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
Using bindSetter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
Working through a scripted binding example . . . . . . . . . . . . . . . . . . . . . . . . 198
Adding validators and formatters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
Understanding validators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
Creating a custom validator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
Understanding formatters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
Creating a custom formatter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207

Chapter 7 Introduction to XML. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209


Understanding XML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
What is an XML document? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
Understanding the XML framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
A brief history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
Understanding why you should use XML . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
Simplicity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
Flexibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
Readability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
Accessibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
Platform and vendor independence . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
Using XML information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
Understanding the structure of an XML document . . . . . . . . . . . . . . . . . . . . . . . 214
The document prolog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
The XML declaration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
Processing instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
Document Type Definitions (DTDs) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216

xi
8946Ch00CMP4 11/12/07 8:46 AM Page xii

CONTENTS

The document tree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216


The document root . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218
Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
Entities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
CDATA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
White space . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
Namespaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
A simple MXML document . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
Understanding the term “well-formed” . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
Element structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
Elements must be closed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
Elements must nest correctly . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
Use quotes for attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224

Chapter 8 Using XML in Flex Builder . . . . . . . . . . . . . . . . . . . . . . . . 227


Working with XML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228
Understanding E4X expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228
Understanding the XML and XMLList classes . . . . . . . . . . . . . . . . . . . . . . . . . 231
Properties of the XML class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
Methods of the XML class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
Manipulating XML content . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
Changing node and attribute values . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
Adding new nodes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
Copying nodes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
Deleting nodes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
Working with the <mx:XML> tag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
Loading an external XML document . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
Using the <mx:HTTPService> tag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
Using the HTTPService class with ActionScript . . . . . . . . . . . . . . . . . . . . . . . . 242
Using the URLLoader class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
Problem solving . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
Binding XML content with E4X expressions . . . . . . . . . . . . . . . . . . . . . . . . . 244
Working through an example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
Consuming web services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253
Working with the WebService class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253
Properties of the WebService class . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254
Methods of the WebService class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255
Creating the web service request . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255
Specifying the operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256
Making the request . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257
Receiving a response . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258
Accessing the web service response . . . . . . . . . . . . . . . . . . . . . . . . . . . 258
Understanding data types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258
Consuming a web service with the <mx:WebService> tag . . . . . . . . . . . . . . . . . 259
Consuming a web service with ActionScript . . . . . . . . . . . . . . . . . . . . . . . . . 263
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265

xii
8946Ch00CMP4 11/12/07 8:46 AM Page xiii

CONTENTS

Chapter 9 Flex Data-Driven Controls . . . . . . . . . . . . . . . . . . . . . . . . 267


Working with a dataProvider . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268
Using the Repeater control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
Setting the dataProvider . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
Using XML as a dataProvider . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270
Iterating through controls in a Repeater . . . . . . . . . . . . . . . . . . . . . . . . . . . 271
Working through a simple example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272
Using the TileList . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276
Displaying images in a TileList . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276
Changing the direction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278
Using a custom item renderer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279
Responding to user interactions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281
Working through an example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281
Using the DataGrid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284
Specifying column settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285
Sorting columns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287
Reordering columns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287
Setting the display of data within a column . . . . . . . . . . . . . . . . . . . . . . . . . 288
Wrapping text within a column . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289
Using renderers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289
Working with a drop-in renderer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290
Working with an inline renderer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291
Working with a custom renderer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
Choosing a renderer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
Editing content . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
Using the default item editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294
Using a drop-in item editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
Using an inline item editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296
Using a custom item editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296
Other column properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297
Working with rows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297
Using common DataGrid events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298
Working with the change event . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298
Working with the itemClick event . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299
Working through a DataGrid example . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309

Chapter 10 Debugging Flex Applications . . . . . . . . . . . . . . . . . . . . . 311


Working with the trace method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312
Logging to a text file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313
Working with the <mx:TraceTarget> tag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314
Understanding Flex errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315
Compiler warning messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315
Compiler errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316
Run-time errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317
Using ActionScript to catch run-time errors . . . . . . . . . . . . . . . . . . . . . . . . . 318
Working with try catch blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318
Including more than one catch block . . . . . . . . . . . . . . . . . . . . . . . . . . 320

xiii
8946Ch00CMP4 11/12/07 8:46 AM Page xiv

CONTENTS

Adding a finally block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321


Throwing custom errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321
Creating custom errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322
Using the debugger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323
Adding breakpoints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325
Managing breakpoints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326
Viewing variable values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326
Changing the value of a variable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 328
Watching a variable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330

PART 2 DATA-DRIVEN APPLICATIONS


Chapter 11 XML Case Study . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333
Understanding the application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334
The application interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334
The application data source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336
The assets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336
Structuring the application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336
Creating the application structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337
Creating the interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337
Creating the custom class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 338
Creating the custom component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339
Writing the custom class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339
Declaring private variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 340
Creating the constructor method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 340
Loading the XML document . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341
Creating the GalleryLoader object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342
Processing the loaded XML content . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343
Populating the ComboBox with galleries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345
Building the custom component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346
Creating the interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346
Configuring the component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347
Displaying the first image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349
Displaying the other images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355

Chapter 12 ColdFusion Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357


Understanding the application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358
The application data source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360
Structuring the application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361
Creating the application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361
Connecting to the ColdFusion server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361
Creating the ColdFusion page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364
Creating the Flex application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366
Creating the Flex interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373

xiv
8946Ch00CMP4 11/12/07 8:46 AM Page xv

CONTENTS

Chapter 13 ASP.NET Case Study . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375


Understanding the application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 376
The application interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 376
The application data source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 378
The database structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 378
The XML content . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 380
Structuring the application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 381
Creating the application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383
Creating the Flex application interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384
Creating the ASP.NET pages to generate XML content for the application . . . . . . . . 386
Displaying a list of events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 387
Displaying a list of categories and locations . . . . . . . . . . . . . . . . . . . . . . . 389
Creating the custom class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 391
Loading the events for a specific date . . . . . . . . . . . . . . . . . . . . . . . . . . . . 393
Populating the interface with the events . . . . . . . . . . . . . . . . . . . . . . . . . . . 395
Creating a custom component for event details . . . . . . . . . . . . . . . . . . . . . . . 399
Showing details of the selected event . . . . . . . . . . . . . . . . . . . . . . . . . . . . 406
Updating the selected event . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 407
Updating in Flex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 407
Updating in ASP.NET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 411
Testing the update . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 413
Adding a new event . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 415
Deleting an event . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 416
Deleting in Flex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 416
Deleting in ASP.NET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 418
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 419

Chapter 14 PHP Case Study . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 421


Understanding the application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 422
The application interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 422
The application data source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 426
Viewing the XML content . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 426
Structuring the application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 428
Creating the application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 429
Creating the Flex application interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . 430
Creating the PHP pages to generate the XML content . . . . . . . . . . . . . . . . . . . 433
Creating the custom ActionScript class to load the content . . . . . . . . . . . . . . . . 436
Loading the XML content . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 438
Creating custom events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 439
Creating the MessageEvent class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 439
Creating the PostsEvent class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 440
Dispatching events from the completeHandler function . . . . . . . . . . . . . . . . 441
Displaying the current posts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 442
Displaying the title and date . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 442
Displaying the content . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 444
Changing the date format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 444
Displaying the archive posts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 445
Disabling administrator functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 448

xv
8946Ch00CMP4 11/12/07 8:46 AM Page xvi

CONTENTS

Coding the login form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 448


Creating a custom component for post details . . . . . . . . . . . . . . . . . . . . . . . 452
Updating the selected post . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 454
Creating the custom class to store post values . . . . . . . . . . . . . . . . . . . . . 454
Creating the editPost function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 455
Handling the edit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 456
Processing the updates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 457
Validating the form contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 458
Responding to the returned message . . . . . . . . . . . . . . . . . . . . . . . . . . 461
Refreshing the data provider for the Repeater . . . . . . . . . . . . . . . . . . . . . 462
Adding a new post . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 463
Deleting an existing post . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 464
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 466

PART 3 LIVECYCLE DATA SERVICES


Chapter 15 Introduction to LiveCycle Data Services . . . . . . . . . . . . 469
LiveCycle Data Services features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 470
Installing LiveCycle Data Services ES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 471
LDS with integrated JRUN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 472
LDS J2EE application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 472
LiveCycle Data Services ES directory structure . . . . . . . . . . . . . . . . . . . . . 473
Set up a Flex application for use with LiveCycle Data Services ES . . . . . . . . . . . . . 474
Using JRun . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 475
Using Tomcat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 475
Using LiveCycle Data Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 475
Message Service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 476
Building a basic chat application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 476
Setting up the message destination . . . . . . . . . . . . . . . . . . . . . . . . . . . 477
Sending messages to the server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 478
Receiving messages from the server . . . . . . . . . . . . . . . . . . . . . . . . . . . 479
RPC services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 481
Exploring web and HTTP services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 481
Understanding the Proxy Service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 482
Consuming a web service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 482
Consuming an HTTP service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 486
Exploring the remote object service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 489
Consuming a simple remote object service . . . . . . . . . . . . . . . . . . . . . . . 489
Data Management Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 497
Using DMS with SQLAssembler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 499
Setting up the Flex project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 499
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 509

xvi
8946Ch00CMP4 11/12/07 8:46 AM Page xvii

CONTENTS

Chapter 16 LiveCycle Data Services Case Study. . . . . . . . . . . . . . . . 511


Understanding the case study . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 512
The book admin application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 512
The book viewer application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 513
The server-side configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 514
Creating the book admin application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 516
Showing the selected book details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 517
Creating the client-side Book class . . . . . . . . . . . . . . . . . . . . . . . . . . . . 518
Populating the form with the book details . . . . . . . . . . . . . . . . . . . . . . . 519
Showing the book cover image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 520
Updating the selected book details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 521
Deleting a Book object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 522
Adding a Book object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 523
Uploading a book cover to the server . . . . . . . . . . . . . . . . . . . . . . . . . . . . 523
Creating a FileReference object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 524
Browsing the file system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 524
Uploading the selected file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 525
Understanding the server-side script . . . . . . . . . . . . . . . . . . . . . . . . . . . 526
Creating the book viewer application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 528
Adding an application ControlBar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 528
Setting up the Flex DataService . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 529
Building the custom item renderer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 530
Showing the books in a TileList . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 531
Showing the details of each book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 532
Testing both applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 533
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 533

Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 534

xvii
8946Ch00CMP4 11/12/07 8:46 AM Page xviii
8946Ch00CMP4 11/12/07 8:46 AM Page xix

ABOUT THE AUTHORS

Sas Jacobs is a web developer who set up her own business, Anything Is
Possible, in 1994, working in the areas of web development, IT training,
and technical writing. The business works with large and small clients
building web applications with .NET, Flash, XML, and databases.

Sas has spoken at such conferences as Flashforward, webDU (previously


known as MXDU), and FlashKit on topics related to XML and dynamic
content in Flash. She is also the author of books about Flash and XML.

In her spare time, Sas is passionate about traveling, photography, run-


ning, and enjoying life.

Koen De Weggheleire is a faculty member of the Technical University


of West-Flanders (HOWEST), department PIH-Multimedia and
Communication Technology (MCT) in Belgium, where he teaches Flash
Platform Solutions (Flash, Flex, AIR) with a smile. As the Adobe User
Group Manager for Belgium (www.adobeusergroup.be), Koen is heavily
addicted to the community and inspires the community by his blog
(www.newmovieclip.com) and by speaking at national and international
industry events. Koen also coordinates the yearly Belgian multimedia
conference, Multi-Mania (www.multi-mania.be), where 800 people
come together to learn from industry experts and to share knowledge.

When he has time, you can find Koen doing freelance Flash platform consultancy on advanced
award-winning Rich Internet Applications.

Sometimes it happens that Koen is not talking ActionScript. Then you can find him producing
music, collecting Adobe gadgets, eating pizza, or renovating his 100-year-old house.

xix
8946Ch00CMP4 11/12/07 8:46 AM Page xx

888bba9cf12226c8bc6011165b8042d4
Exploring the Variety of Random
Documents with Different Content
*** END OF THE PROJECT GUTENBERG EBOOK SECRET SERVICE
UNDER PITT ***

Updated editions will replace the previous one—the old editions


will be renamed.

Creating the works from print editions not protected by U.S.


copyright law means that no one owns a United States
copyright in these works, so the Foundation (and you!) can copy
and distribute it in the United States without permission and
without paying copyright royalties. Special rules, set forth in the
General Terms of Use part of this license, apply to copying and
distributing Project Gutenberg™ electronic works to protect the
PROJECT GUTENBERG™ concept and trademark. Project
Gutenberg is a registered trademark, and may not be used if
you charge for an eBook, except by following the terms of the
trademark license, including paying royalties for use of the
Project Gutenberg trademark. If you do not charge anything for
copies of this eBook, complying with the trademark license is
very easy. You may use this eBook for nearly any purpose such
as creation of derivative works, reports, performances and
research. Project Gutenberg eBooks may be modified and
printed and given away—you may do practically ANYTHING in
the United States with eBooks not protected by U.S. copyright
law. Redistribution is subject to the trademark license, especially
commercial redistribution.

START: FULL LICENSE


THE FULL PROJECT GUTENBERG LICENSE
PLEASE READ THIS BEFORE YOU DISTRIBUTE OR USE THIS WORK

To protect the Project Gutenberg™ mission of promoting the


free distribution of electronic works, by using or distributing this
work (or any other work associated in any way with the phrase
“Project Gutenberg”), you agree to comply with all the terms of
the Full Project Gutenberg™ License available with this file or
online at www.gutenberg.org/license.

Section 1. General Terms of Use and


Redistributing Project Gutenberg™
electronic works
1.A. By reading or using any part of this Project Gutenberg™
electronic work, you indicate that you have read, understand,
agree to and accept all the terms of this license and intellectual
property (trademark/copyright) agreement. If you do not agree
to abide by all the terms of this agreement, you must cease
using and return or destroy all copies of Project Gutenberg™
electronic works in your possession. If you paid a fee for
obtaining a copy of or access to a Project Gutenberg™
electronic work and you do not agree to be bound by the terms
of this agreement, you may obtain a refund from the person or
entity to whom you paid the fee as set forth in paragraph 1.E.8.

1.B. “Project Gutenberg” is a registered trademark. It may only


be used on or associated in any way with an electronic work by
people who agree to be bound by the terms of this agreement.
There are a few things that you can do with most Project
Gutenberg™ electronic works even without complying with the
full terms of this agreement. See paragraph 1.C below. There
are a lot of things you can do with Project Gutenberg™
electronic works if you follow the terms of this agreement and
help preserve free future access to Project Gutenberg™
electronic works. See paragraph 1.E below.
1.C. The Project Gutenberg Literary Archive Foundation (“the
Foundation” or PGLAF), owns a compilation copyright in the
collection of Project Gutenberg™ electronic works. Nearly all the
individual works in the collection are in the public domain in the
United States. If an individual work is unprotected by copyright
law in the United States and you are located in the United
States, we do not claim a right to prevent you from copying,
distributing, performing, displaying or creating derivative works
based on the work as long as all references to Project
Gutenberg are removed. Of course, we hope that you will
support the Project Gutenberg™ mission of promoting free
access to electronic works by freely sharing Project Gutenberg™
works in compliance with the terms of this agreement for
keeping the Project Gutenberg™ name associated with the
work. You can easily comply with the terms of this agreement
by keeping this work in the same format with its attached full
Project Gutenberg™ License when you share it without charge
with others.

1.D. The copyright laws of the place where you are located also
govern what you can do with this work. Copyright laws in most
countries are in a constant state of change. If you are outside
the United States, check the laws of your country in addition to
the terms of this agreement before downloading, copying,
displaying, performing, distributing or creating derivative works
based on this work or any other Project Gutenberg™ work. The
Foundation makes no representations concerning the copyright
status of any work in any country other than the United States.

1.E. Unless you have removed all references to Project


Gutenberg:

1.E.1. The following sentence, with active links to, or other


immediate access to, the full Project Gutenberg™ License must
appear prominently whenever any copy of a Project
Gutenberg™ work (any work on which the phrase “Project
Gutenberg” appears, or with which the phrase “Project
Gutenberg” is associated) is accessed, displayed, performed,
viewed, copied or distributed:

This eBook is for the use of anyone anywhere in the United


States and most other parts of the world at no cost and
with almost no restrictions whatsoever. You may copy it,
give it away or re-use it under the terms of the Project
Gutenberg License included with this eBook or online at
www.gutenberg.org. If you are not located in the United
States, you will have to check the laws of the country
where you are located before using this eBook.

1.E.2. If an individual Project Gutenberg™ electronic work is


derived from texts not protected by U.S. copyright law (does not
contain a notice indicating that it is posted with permission of
the copyright holder), the work can be copied and distributed to
anyone in the United States without paying any fees or charges.
If you are redistributing or providing access to a work with the
phrase “Project Gutenberg” associated with or appearing on the
work, you must comply either with the requirements of
paragraphs 1.E.1 through 1.E.7 or obtain permission for the use
of the work and the Project Gutenberg™ trademark as set forth
in paragraphs 1.E.8 or 1.E.9.

1.E.3. If an individual Project Gutenberg™ electronic work is


posted with the permission of the copyright holder, your use and
distribution must comply with both paragraphs 1.E.1 through
1.E.7 and any additional terms imposed by the copyright holder.
Additional terms will be linked to the Project Gutenberg™
License for all works posted with the permission of the copyright
holder found at the beginning of this work.

1.E.4. Do not unlink or detach or remove the full Project


Gutenberg™ License terms from this work, or any files
containing a part of this work or any other work associated with
Project Gutenberg™.

1.E.5. Do not copy, display, perform, distribute or redistribute


this electronic work, or any part of this electronic work, without
prominently displaying the sentence set forth in paragraph 1.E.1
with active links or immediate access to the full terms of the
Project Gutenberg™ License.

1.E.6. You may convert to and distribute this work in any binary,
compressed, marked up, nonproprietary or proprietary form,
including any word processing or hypertext form. However, if
you provide access to or distribute copies of a Project
Gutenberg™ work in a format other than “Plain Vanilla ASCII” or
other format used in the official version posted on the official
Project Gutenberg™ website (www.gutenberg.org), you must,
at no additional cost, fee or expense to the user, provide a copy,
a means of exporting a copy, or a means of obtaining a copy
upon request, of the work in its original “Plain Vanilla ASCII” or
other form. Any alternate format must include the full Project
Gutenberg™ License as specified in paragraph 1.E.1.

1.E.7. Do not charge a fee for access to, viewing, displaying,


performing, copying or distributing any Project Gutenberg™
works unless you comply with paragraph 1.E.8 or 1.E.9.

1.E.8. You may charge a reasonable fee for copies of or


providing access to or distributing Project Gutenberg™
electronic works provided that:
• You pay a royalty fee of 20% of the gross profits you derive
from the use of Project Gutenberg™ works calculated using the
method you already use to calculate your applicable taxes. The
fee is owed to the owner of the Project Gutenberg™ trademark,
but he has agreed to donate royalties under this paragraph to
the Project Gutenberg Literary Archive Foundation. Royalty
payments must be paid within 60 days following each date on
which you prepare (or are legally required to prepare) your
periodic tax returns. Royalty payments should be clearly marked
as such and sent to the Project Gutenberg Literary Archive
Foundation at the address specified in Section 4, “Information
about donations to the Project Gutenberg Literary Archive
Foundation.”

• You provide a full refund of any money paid by a user who


notifies you in writing (or by e-mail) within 30 days of receipt
that s/he does not agree to the terms of the full Project
Gutenberg™ License. You must require such a user to return or
destroy all copies of the works possessed in a physical medium
and discontinue all use of and all access to other copies of
Project Gutenberg™ works.

• You provide, in accordance with paragraph 1.F.3, a full refund of


any money paid for a work or a replacement copy, if a defect in
the electronic work is discovered and reported to you within 90
days of receipt of the work.

• You comply with all other terms of this agreement for free
distribution of Project Gutenberg™ works.

1.E.9. If you wish to charge a fee or distribute a Project


Gutenberg™ electronic work or group of works on different
terms than are set forth in this agreement, you must obtain
permission in writing from the Project Gutenberg Literary
Archive Foundation, the manager of the Project Gutenberg™
trademark. Contact the Foundation as set forth in Section 3
below.

1.F.

1.F.1. Project Gutenberg volunteers and employees expend


considerable effort to identify, do copyright research on,
transcribe and proofread works not protected by U.S. copyright
law in creating the Project Gutenberg™ collection. Despite these
efforts, Project Gutenberg™ electronic works, and the medium
on which they may be stored, may contain “Defects,” such as,
but not limited to, incomplete, inaccurate or corrupt data,
transcription errors, a copyright or other intellectual property
infringement, a defective or damaged disk or other medium, a
computer virus, or computer codes that damage or cannot be
read by your equipment.

1.F.2. LIMITED WARRANTY, DISCLAIMER OF DAMAGES - Except


for the “Right of Replacement or Refund” described in
paragraph 1.F.3, the Project Gutenberg Literary Archive
Foundation, the owner of the Project Gutenberg™ trademark,
and any other party distributing a Project Gutenberg™ electronic
work under this agreement, disclaim all liability to you for
damages, costs and expenses, including legal fees. YOU AGREE
THAT YOU HAVE NO REMEDIES FOR NEGLIGENCE, STRICT
LIABILITY, BREACH OF WARRANTY OR BREACH OF CONTRACT
EXCEPT THOSE PROVIDED IN PARAGRAPH 1.F.3. YOU AGREE
THAT THE FOUNDATION, THE TRADEMARK OWNER, AND ANY
DISTRIBUTOR UNDER THIS AGREEMENT WILL NOT BE LIABLE
TO YOU FOR ACTUAL, DIRECT, INDIRECT, CONSEQUENTIAL,
PUNITIVE OR INCIDENTAL DAMAGES EVEN IF YOU GIVE
NOTICE OF THE POSSIBILITY OF SUCH DAMAGE.
1.F.3. LIMITED RIGHT OF REPLACEMENT OR REFUND - If you
discover a defect in this electronic work within 90 days of
receiving it, you can receive a refund of the money (if any) you
paid for it by sending a written explanation to the person you
received the work from. If you received the work on a physical
medium, you must return the medium with your written
explanation. The person or entity that provided you with the
defective work may elect to provide a replacement copy in lieu
of a refund. If you received the work electronically, the person
or entity providing it to you may choose to give you a second
opportunity to receive the work electronically in lieu of a refund.
If the second copy is also defective, you may demand a refund
in writing without further opportunities to fix the problem.

1.F.4. Except for the limited right of replacement or refund set


forth in paragraph 1.F.3, this work is provided to you ‘AS-IS’,
WITH NO OTHER WARRANTIES OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO WARRANTIES OF
MERCHANTABILITY OR FITNESS FOR ANY PURPOSE.

1.F.5. Some states do not allow disclaimers of certain implied


warranties or the exclusion or limitation of certain types of
damages. If any disclaimer or limitation set forth in this
agreement violates the law of the state applicable to this
agreement, the agreement shall be interpreted to make the
maximum disclaimer or limitation permitted by the applicable
state law. The invalidity or unenforceability of any provision of
this agreement shall not void the remaining provisions.

1.F.6. INDEMNITY - You agree to indemnify and hold the


Foundation, the trademark owner, any agent or employee of the
Foundation, anyone providing copies of Project Gutenberg™
electronic works in accordance with this agreement, and any
volunteers associated with the production, promotion and
distribution of Project Gutenberg™ electronic works, harmless
from all liability, costs and expenses, including legal fees, that
arise directly or indirectly from any of the following which you
do or cause to occur: (a) distribution of this or any Project
Gutenberg™ work, (b) alteration, modification, or additions or
deletions to any Project Gutenberg™ work, and (c) any Defect
you cause.

Section 2. Information about the Mission


of Project Gutenberg™
Project Gutenberg™ is synonymous with the free distribution of
electronic works in formats readable by the widest variety of
computers including obsolete, old, middle-aged and new
computers. It exists because of the efforts of hundreds of
volunteers and donations from people in all walks of life.

Volunteers and financial support to provide volunteers with the


assistance they need are critical to reaching Project
Gutenberg™’s goals and ensuring that the Project Gutenberg™
collection will remain freely available for generations to come. In
2001, the Project Gutenberg Literary Archive Foundation was
created to provide a secure and permanent future for Project
Gutenberg™ and future generations. To learn more about the
Project Gutenberg Literary Archive Foundation and how your
efforts and donations can help, see Sections 3 and 4 and the
Foundation information page at www.gutenberg.org.

Section 3. Information about the Project


Gutenberg Literary Archive Foundation
The Project Gutenberg Literary Archive Foundation is a non-
profit 501(c)(3) educational corporation organized under the
laws of the state of Mississippi and granted tax exempt status
by the Internal Revenue Service. The Foundation’s EIN or
federal tax identification number is 64-6221541. Contributions
to the Project Gutenberg Literary Archive Foundation are tax
deductible to the full extent permitted by U.S. federal laws and
your state’s laws.

The Foundation’s business office is located at 809 North 1500


West, Salt Lake City, UT 84116, (801) 596-1887. Email contact
links and up to date contact information can be found at the
Foundation’s website and official page at
www.gutenberg.org/contact

Section 4. Information about Donations to


the Project Gutenberg Literary Archive
Foundation
Project Gutenberg™ depends upon and cannot survive without
widespread public support and donations to carry out its mission
of increasing the number of public domain and licensed works
that can be freely distributed in machine-readable form
accessible by the widest array of equipment including outdated
equipment. Many small donations ($1 to $5,000) are particularly
important to maintaining tax exempt status with the IRS.

The Foundation is committed to complying with the laws


regulating charities and charitable donations in all 50 states of
the United States. Compliance requirements are not uniform
and it takes a considerable effort, much paperwork and many
fees to meet and keep up with these requirements. We do not
solicit donations in locations where we have not received written
confirmation of compliance. To SEND DONATIONS or determine
the status of compliance for any particular state visit
www.gutenberg.org/donate.

While we cannot and do not solicit contributions from states


where we have not met the solicitation requirements, we know
of no prohibition against accepting unsolicited donations from
donors in such states who approach us with offers to donate.

International donations are gratefully accepted, but we cannot


make any statements concerning tax treatment of donations
received from outside the United States. U.S. laws alone swamp
our small staff.

Please check the Project Gutenberg web pages for current


donation methods and addresses. Donations are accepted in a
number of other ways including checks, online payments and
credit card donations. To donate, please visit:
www.gutenberg.org/donate.

Section 5. General Information About


Project Gutenberg™ electronic works
Professor Michael S. Hart was the originator of the Project
Gutenberg™ concept of a library of electronic works that could
be freely shared with anyone. For forty years, he produced and
distributed Project Gutenberg™ eBooks with only a loose
network of volunteer support.

Project Gutenberg™ eBooks are often created from several


printed editions, all of which are confirmed as not protected by
copyright in the U.S. unless a copyright notice is included. Thus,
we do not necessarily keep eBooks in compliance with any
particular paper edition.

Most people start at our website which has the main PG search
facility: www.gutenberg.org.

This website includes information about Project Gutenberg™,


including how to make donations to the Project Gutenberg
Literary Archive Foundation, how to help produce our new
eBooks, and how to subscribe to our email newsletter to hear
about new eBooks.
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebooknice.com

You might also like