O'Reilly logo

Professional Adobe® Flex® 3 by Joe Berkovitz, David Hassoun, Andrew Trice, Tom Sugden, Todd Prekaski, Jun Heider, Peter Ent, Joseph Balderson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 12. User Interface Controls and Containers

This chapter describes the Flex components used to present data, accept input, and define the application's layout. Rather than duplicating the Flex documents of the components, with their properties, methods, events, and styles, this chapter gives you some practical tips and ideas for using the components in your applications.

Static Controls

These controls present information and are not normally used for any input.

mx.controls.Label and mx.controls.Text

These controls display static text. Although both controls will display a string of characters, the Label control can display only one line of text and will truncate the string if necessary, whereas the Text control will word-wrap the string and automatically increase its height to accommodate the text.

Both controls use the same styles and methods. Figure 12-1 provides an example for each of these controls.

Figure 12-1

Figure 12-1. Figure 12-1

The following shows the code behind the controls:

<mx:Label text="Hello" />
<mx:Text text="World" />

Tips:

  • The selectable property for the Text control is set to true by default, which allows you to highlight the text displayed within the component; it is false for Label. If you use Text and Label interchangeably, you may want to set the Text control's selectable property to false.

  • When a Label control is not wide enough to contain all its text, the remainder is ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required