Chapter 7. Formatting data

 

This chapter covers

  • Formatting raw data with Flex’s built-in formatters
  • Types of formatters
  • Real-time formatting and scripted formatting
  • Dealing with formatting errors

Formatters are a class of objects that take raw data and transform it into a presentable visual format. From a usage perspective, they’re comparable to validators in that similar mechanisms are employed to implement them. Formatters can be configured to function in two modes:

  • Real-time— Formatting is conducted on the fly automatically via data binding.
  • Scripted— Using ActionScript you can create instances of formatters explicitly when needed and process the data accordingly.

The most important thing to know is that formatters are incredibly easy to use. Raw data is fed in and structured, and legible content is delivered back. In this chapter we show you how to use the built-in formatters that come with Flex and all the ways they can be applied.

7.1. Built-in formatters

7.2. Real-time formatting

7.3. Scripted formatting

7.4. Working with formatting errors

7.5. Summary