ADOBE FLEX BUILDER 3
Using Adobe Flex Builder 3
In this MXML example, the validator is defined with the appropriate MXML tag, and it is bound to the ID property
of a TextInput control. At run time, when the user enters the phone number into the TextInput control, the number
is immediately validated.
You can, of course, use data validators in ActionScript by defining a variable as an instance of a validator class and
then creating a function to bind it to the input control.
Data validators are often used with data models. For more information, see “Validating Data” on page 1008 in the
Adobe Flex 3 Developer Guide.
To display the proper format of certain types of data in your application, you use a data formatter. Flex provides
predefined data formatters for the following types of data: currency, date, number, phone, and ZIP code.
Data formatters are bound to input controls, and they format data correctly after the user enters it. For example, a
user might enter a date in this format:
Bound to the text input control is a data formatter that stores and displays the date in this format:
As with data validators, data formatters are nonvisual Flex components that you can work with either as MXML tags
or as ActionScript classes.
For more information, see “Formatting Data” on page 1039 in the Adobe Flex 3 Developer Guide.
Automatically generating database applications
You can use Flex Builder data wizards to automatically generate create, read, update, delete (CRUD) database appli-
cations for existing PHP, J2EE, and ASP.NET server projects. From the Create Application from Database option on
the Data menu, you can select an SQL database table and generate an entire application that includes both client-side
and server-side code.
For information about creating server projects in which you can create database applications, see “Working with
Projects” on page 27.
Generating a PHP database application
You can generate an application that uses PHP and a MySQL database. To generate this type of application, you must
have a local PHP server and access to a target MySQL database table.
Generate PHP application code
1 If you have not already done so, create a Flex project that specifies PHP as its application server type.
2 Select Data > Create Application from Database.
3 From the Project list, select the PHP project to use.
4 From the Connection list, select a database connection profile. To create and use a new connection profile, click
the New button and complete the text boxes. For more information, see
“Directory structure and deployment
considerations for PHP” on page 187.
5 From the Table list, select the database table to use.
6 From the Primary Key list, select the primary key of the database table if it is not already selected.