Book Image

Flex 3 with Java

Book Image

Flex 3 with Java

Overview of this book

Flex 3 is a great technology for developing Rich Internet Applications for the Web as well as for the desktop. If you are a developer looking to design great-looking and sophisticated user interfaces that resemble desktop-based applications, and want to utilize an existing server technology such as Java to develop RIAs, this book is for you. Targeting developers who want to get started with Adobe Flex 3 programming, this simple and clear handbook introduces Flex technology quickly and straightforwardly. Utilizing your existing knowledge of Java, it gives you the insight and hands-on experience to program with Flex 3. This book provides comprehensive information on various aspects of Flex 3 and ActionScript 3.0. These include developing simple applications, handling events, creating custom components and events, using RPC services, integration with Java and BlazeDS, styling and formatting, and how to package and deploy Flex applications. You will start with downloading, installing and configuring Flex 3 SDK and Flex Builder 3 and learn basic concepts such as what MXML and ActionScript are, understanding UI components, controls, compilers, and more. Further you will develop simple applications and slowly advance into more depth where you will learn advanced concepts such as creating custom components, debugging, integrating with Java, using RPC services, styling, internationalizing, and deploying Flex applications, and more. One of the things you're really going to love about this book is that you will develop a full-blown e-commerce application using a combination of Flex 3, ActionScript 3.0, BlazeDS 3.2, and Java. At the end of the book you will have the knowledge and experience needed to develop Rich Internet Applications.
Table of Contents (18 chapters)
Flex 3 with Java
Credits
About the Author
About the Reviewers
Preface
8
Communicating with Server-side Java

Preface

Rich Internet applications (RIAs) are a new breed of web applications that are capable of doing things such as loading and handling heavy data ten times faster than HTTP, designing great-looking and sophisticated user interfaces that resemble desktop-based applications, and having the possibility of utilizing existing server technology such as Java, that would have never been possible with typical web technologies, such as HTML. Flex 3 is a leading technology for developing RIAs for the Web, as well as for the desktop. This book gives you an insight into, and provides a hands-on experience in, programming in Flex 3 by utilizing your existing knowledge of Java programming.

This book includes comprehensive information on various concepts of Flex 3 and ActionScript 3.0, such as developing simple applications and handling events to creating custom components and events, using RPC services, integration with Java and BlazeDS, styling and formatting, and how to package and deploy Flex applications. Finally, this book provides a step-by-step tutorial for developing e-commerce applications using Flex 3, ActionScript 3.0, BlazeDS, and Java.

You will start with downloading, installing, and configuring Flex 3 SDK and Flex Builder 3 and learn basic concepts, such as what is Macromedia Flex Markup Language (MXML) and ActionScript, understanding UI components, controls and compilers, and so on. Furthermore, you will start developing simple applications and slowly go into more depth where you will learn advanced concepts, such as creating custom components, debugging, integrating with Java, using RPC services, styling, internationalizing, and deploying Flex applications, and much more.

What this book covers

Chapter 1: Installing and Configuring Adobe Flex—In this chapter, you will learn the basics of Flex programming, that is, downloading, installing, and configuring Flex SDK and Flex Builder 3.

Chapter 2: Introduction to Flex 3 Framework—This chapter will introduce you to the MXML scripting for laying out User Interfaces (UI) in the Flex world. This chapter also provides hands-on examples required to get you started with MXML programming.

Chapter 3: Introduction to ActionScript 3.0—This chapter will introduce you to the ActionScript 3.0 programming language along with detailed code samples.

Chapter 4: Using External API and LocalConnection - In this chapter, you will learn how to communicate with JavaScript from a Flex application and vice versa.

Chapter 5: Working with XML—In this chapter, you will learn how to work with XML data using Flex's E4X approach.

Chapter 6:Overview of LiveCycle Data Services and BlazeDS—This chapter will provide an overview of BlazeDS and LiveCycle Data Services.

Chapter 7: Flex Data Access Methods—This chapter provides you with in-depth information about various data access methods available in Flex with detailed and step-by-step code samples along with Flash Player security model. It also gives you a detailed insight into how to use RemoteObject to communicate with Java code.

Chapter 8: Communicating with Server-side Java—This chapter provides step-by-step code examples to get started with Flex and Java communication along with clear and simple code examples..

Chapter 9: Debugging Techniques—In this chapter, you will learn how to debug your Flex application using Flex Builder 3 and some third-party tools.

Chapter 10: Packaging and Deployment—You will learn how to build and package a Flex application using available tools, such as Apache Ant, and learn about various deployment options that you can use.

Chapter 11: Styling Your Application—This chapter will give an overview of using Cascading Style Sheet (CSS) for changing the look and feel of your Flex application and components with brief code examples and tools for designing CSS files.

Chapter 12: Internationalization and Localization—This chapter will give you an overview of internationalizing your application.

Chapter 13: Creating an E-commerce Application—This chapter will provide a step-by-step guide for creating an end-to-end e-commerce application using Flex 3, ActionScript 3.0, BlazeDS, and Java.

What you need for this book

First and foremost, you need to have a need for learning Flex 3 technology; yes, I say that because most of us learn a new technology either by accident or because of some need, such as client/project demand or for doing things that are not possible with current technology or maybe you just want to upgrade your skill sets. Whatever is your reason behind learning Flex 3, I assure you that this book will serve as a simple and clear handbook for any developers to get started with Adobe Flex 3 programming.

Although this book is very easy to read and understand for any novice programmer, having some basic knowledge of Java programming in general, including Java Server Pages (JSP), would help you to pick up quickly. Apart from this, I assume that you have already heard about terms such as Rich Internet applications (RIAs) and understand theory behind it; if not, then please visit http://en.wikipedia.org/wiki/Rich_Internet_application.

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text are shown as follows: " The ExternalInterface.available property can be used to determine if the container application that is hosting your Flash Player instance supports an external interface."

A block of code is set as follows:

<mx:Style>
Label
{
color: #ffff00;
fontSize: 20;
fontWeight: bold;
}
</mx:Style>

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

<mx:Style>
Label
{
color: #ffff00;
fontSize: 20;
fontWeight: bold;
}
Label.helloStyle

{
color: red;
fontSize: 20;
fontStyle: italic;
}
Label.bonjourStyle

{
color: blue;
fontFamily: Arial;
fontSize: 20;
}
</mx:Style>

Any command-line input or output is written as follows:

mxmlc -library-path+=..../MyLibraries/bin/Main.mxml

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "clicking the Next button moves you to the next screen".

Note

Warnings or important notes appear in a box like this.

Note

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an email to, and mention the book title via the subject of your message.

If there is a book that you need and would like to see us publish, please send us a note in the SUGGEST A TITLE form on www.packtpub.com or email.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book on, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code for the book

Visit http://www.packtpub.com/files/code/5340_Code.zip to directly download the example code.

The downloadable files contain instructions on how to use them.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration, and help us to improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/support, selecting your book, clicking on the let us know link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata added to any list of existing errata. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us atwith a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us atif you are having a problem with any aspect of the book, and we will do our best to address it.