Flex 3 In Action: Free Chapters
Join the DZone community and get the full member experience.Join For Free
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.
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
Opinions expressed by DZone contributors are their own.