Skip to Content
Flash 8 Cookbook
book

Flash 8 Cookbook

by Joey Lott
April 2006
Beginner
544 pages
14h 51m
English
O'Reilly Media, Inc.
Content preview from Flash 8 Cookbook

Chapter 14. Building Advanced Flash Forms

Chapter 13 introduced building user input forms in Flash. This chapter takes that topic a few steps further by introducing advanced form features, such as data validation, prepopulating and preselecting data in form controls, dynamically populating forms, and creating responsive form elements.

14.1. Performing Actions When the User Clicks a Checkbox or Radio Button

Problem

You want your Flash application to perform some actions when the user clicks a checkbox or radio button.

Solution

Define a listener object with a click() method and register the listener with the checkbox or radio button group.

Discussion

By default, when the user clicks a checkbox or radio button, Flash doesn’t take any immediate action. In many cases, that is the behavior that you want. However, it is possible to tell Flash that you want it to perform some actions when the user clicks the checkbox or radio button control. There are a variety of reasons why you may want to do that. For example, you may want a form to automatically submit its data when the user clicks the form control rather than using a button.

In order for Flash to know to do something when the user clicks the checkbox or radio button, you need to use a listener object. You can create the listener object using the Object constructor as part of a new statement and assigning the value to a variable. The following code is an example of how you can create a listener object named oListener:

 var oListener:Object = ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Adobe® Dreamweaver® CS5 Bible

Adobe® Dreamweaver® CS5 Bible

Joseph W. Lowery
Flash® CS4 for Dummies®

Flash® CS4 for Dummies®

Ellen Finkelstein, Gurdy Leete
Dreamweaver® CS3 Bible

Dreamweaver® CS3 Bible

Joseph W. Lowery

Publisher Resources

ISBN: 0596102402Catalog PageErrata