Flex 3 In Action: Free Chapters
We're giving away two free chapters from the new Flex 3 In Action book in association with Manning Publications. Flex 3 in Action is an easy-to-follow, hands-on Flex tutorial. This book goes beyond feature coverage and
helps you put Flex to work in real day-to-day tasks. You'll quickly
master the Flex API and learn to apply the techniques that make your
Flex applications stand out from the crowd.
The chapters included are Working With ActionScript and Displaying Forms And Capturing User Input.
Working With ActionScript
ActionScript is an extremely powerful object-oriented language about
which you can dedicate entire books. In this chapter we’ll focus on
ActionScript’s core concepts; obviously you will need to be familiar
with them before we get to the more powerful aspects of Flex itself.
Speaking of which, you’re probably anxious to get back into Flex, but
tackling some ActionScript fundamentals will allow us to pick up the
pace and move further forward.
A fundamental concept in any programming language is that of comments, so we’ll begin our discussion with how Flex supports documenting your code.
Download the rest of this chapter here.
Displaying Forms And Capturing User Input
Let’s put our newly acquired understanding of layout and
ActionScript to work and apply it to a fundamental operation of any
application—capturing user input. As mentioned in chapter 4, even
though Flex offers a Form component, its use is optional and you’ll
find it functions best as a layout tool. In the land of Flex you are
equipped with control components (usually referred to as controls) that
display information and accept user input. Alongside controls are
events and event handlers that recognize and respond to user actions,
such as clicking a mouse.
When event handler functions run, they access data from whatever source
they’ve been instructed; there’s no master Form tag that contains all
the inputs as in HTML.
NOTE Say goodbye to the notion of HTML Forms. The optional
<Form> tag in Flex does nothing more than lay out UI components
called controls.
Remember, you’re not restricted to the set of
controls that come with Flex. Unlike HTML, which limits your UI
controls to the HTML specification and browser implementation, Flex
encourages you to extend an existing control to add more functionality,
or create your own, completely new, UI controls from scratch.
One of the teaching approaches this book employs is to show many ways
of doing the same thing. From example to example, we’ll use an idea
from the previous one, but then change a portion of it to demonstrate
an alternative. The alternatives aren’t necessarily any better, they’re
just different, but more importantly help you to think with the
ActionScript mentality.
A core piece to that understanding is the invaluable id attribute, a handle to an MXML component that allows you to access the values contained by the id attribute.
Download the rest of this chapter here.
James is a DZone Zone Leader and has posted 231 posts at DZone. You can read more from them at their website.
- Login or register to post comments
- 2703 reads
- Printer-friendly version
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)











Comments
Kees Kuip replied on Wed, 2009/05/20 - 2:52am
Why do you (as a zoneleader) advertise your flex book on java lobby?
OtengiM replied on Wed, 2009/05/20 - 3:30am
James Sugrue replied on Wed, 2009/05/20 - 4:44am
in response to: keeskuip
Hi
This isn't my book - we're just giving away free chapters thanks to a collaboration with Manning. The book is written by Tariq Ahmed and Jon Hirsch.
Flex is an important part of the RIA stack, and as it can integrate with Java I feel it's fair to have it on Javalobby
James
Mark Haniford replied on Wed, 2009/05/20 - 11:00pm
Alexander Shirkov replied on Fri, 2009/05/22 - 7:01am
in response to: mark haniford
Mark Haniford replied on Sat, 2009/05/23 - 8:16pm
in response to: sgdread
Flex's eclipse-based IDE doesn't make it any more part of the Java ecosystem than a PHP eclipse plugin makes it part of the Java ecosystem.
But Adobe has done a good job of sending out its evangelists.
michalsss replied on Tue, 2009/06/16 - 12:09pm
emad964 replied on Sat, 2009/06/27 - 4:57pm